Skip to content

Fix: Prevent private backup metadata leaks - #9

Merged
sachk merged 2 commits into
sachk:mainfrom
jpmartins98:fix-privacy-sanitization
Aug 3, 2026
Merged

sachk merged 2 commits into
sachk:mainfrom
jpmartins98:fix-privacy-sanitization

Conversation

@jpmartins98

@jpmartins98 jpmartins98 commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Dependency

This is a stacked PR and depends on #6.

The branch is currently based on commit 040b1a2 from #6 because this
change reuses the centralized smartswitch_core.path_safety implementation.

As a result, the PR currently includes the commits from #6 in its history.
It should not be merged before #6. After #6 is merged, this branch will be
rebased onto the updated main so that only the privacy changes remain in
this PR's diff.

The privacy-specific commit is 5f58173.

Problem

SmartSwitch Explorer could expose local or backup-related information through
several secondary code paths:

  • A diagnostic test contained a non-generic application package identifier.
  • Direct-file import workspaces stored absolute source paths in their synthetic
    SmartSwitchBackup.json.
  • Export manifests included absolute backup paths.
  • Diagnostic anonymization did not fully redact Windows paths containing
    spaces or UNC paths.
  • Root-level JSON, XML, and log files could appear under "Other Backup Data"
    and be exported, despite potentially containing IMEI values, email addresses,
    device identifiers, session credentials, or other private metadata.
  • Abandoned direct-import workspaces were only cleaned during normal GUI
    shutdown.
  • Some export paths and symbolic links required additional validation.

Solution

This PR:

  • replaces staged SourceFiles paths with a non-sensitive file count;
  • removes absolute source paths from generated manifests;
  • applies recursive absolute-path redaction to every manifest written through
    write_manifest;
  • supports Windows paths with spaces, UNC paths, and POSIX paths in diagnostic
    anonymization;
  • excludes root JSON, XML, and log metadata from "Other Backup Data";
  • explicitly prevents direct export of this root metadata;
  • removes the non-generic package identifier from the diagnostic test;
  • cleans abandoned direct-import workspaces on a subsequent application start;
  • rejects symbolic links and unsafe absolute, drive-qualified, or traversal
    output paths;
  • reuses and strengthens the common path-safety implementation introduced by
    Fix authenticated extraction of Smart Switch APKFILE data backups #6 instead of maintaining a second implementation.

The privacy filtering deliberately favors redaction over preserving the
remainder of a diagnostic line once an absolute path is detected.

Validation

104 passed, 2 skipped

The two skipped tests are optional real-backup tests because
SMARTSWITCH_REAL_DATA was not set.

All local PR branches were also checked with git merge-tree. After rebasing
onto #6, no merge conflicts remain with:

No real backup, .data, .penc, log, credential, absolute personal path, or
private fixture is included in this PR.

AI disclosure

This PR, including its implementation, tests, commit message, technical
analysis, and description, was generated with OpenAI Codex. The generated
changes and test results were reviewed and validated locally by the AI coding
agent. No private backup data was provided to an external service.

@sachk
sachk force-pushed the fix-privacy-sanitization branch from 5f58173 to 6f6f0d8 Compare August 3, 2026 09:29
@sachk
sachk merged commit aa4bd47 into sachk:main Aug 3, 2026
4 checks passed
@jpmartins98
jpmartins98 deleted the fix-privacy-sanitization branch August 3, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants