Skip to content

Fix macOS /private path mismatches in report redaction and two test expects - #18

Closed
M3NT8L-One wants to merge 4 commits into
stevecad:mainfrom
M3NT8L-One:fix/macos-private-tmp-paths
Closed

M3NT8L-One wants to merge 4 commits into
stevecad:mainfrom
M3NT8L-One:fix/macos-private-tmp-paths

Conversation

@M3NT8L-One

Copy link
Copy Markdown
Contributor

What doesn't work

On macOS, /tmp and /var are symlinks to /private/tmp and /private/var. Temp paths from tempfile therefore show up as /var/folders/…, while anything that calls Path.resolve() returns /private/var/folders/….

Three unit tests fail only on Mac:

  1. Report redaction (diagnostics.redact_report): the long-token wipe ([A-Za-z0-9_+/=.-]{80,}) runs before home redaction and includes /, so a long absolute path is replaced with [long value omitted] and never becomes [home]. Even with the order fixed, the helper only kept home and Path(home).resolve(), so the unresolved /var/… form (what the log actually contains when the home dir is a symlink) still leaked.
  2. Legacy profile test: asserts target == root/'Steve/CAD' but migrate_profile returns a resolved path.
  3. Windows updates test: asserts pending(profile) == candidate but pending returns a resolved candidate.

The change

  • src/steve_desktop/diagnostics.py: collect home forms (raw, resolve(), symlink readlink target, and the /private-stripped twin), and redact email, home-folder patterns, those home forms and the username before _redact, so the long-value scrub cannot eat paths first. Long secrets and bearer/api-key rules still run afterward.
  • tests/test_desktop_feedback.py: add a symlinked temp-root test that embeds both the lexical and resolved forms (it reproduces on Linux too) and asserts paths of 80+ chars become [home], not [long value omitted]. Add a both-ways check that ordinary short text survives while long opaque values are still scrubbed.
  • tests/test_legacy_profile.py: expect (root/'Steve/CAD').resolve().
  • tests/test_windows_updates.py: expect candidate.resolve().

No change to windows_updates.py, the updater, signing, local_git.py, workflows, or deps.

Tests

macOS (Apple Silicon, Python 3.13), python -m unittest:

3 modules full suite
Before (35aad24) 13 ran, 3 failed 264 ran, 3 failed, 40 skipped
After 15 ran, OK 266 ran, OK, 40 skipped

No Keychain prompt during the runs. Not run on Linux or Windows locally; the new symlink test is written to reproduce on Linux.

4 files, +67 / −7.

@10-X-eng

10-X-eng commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution! We take pull requests of one change each. Small pull requests that make one change each can be reviewed carefully and tested on their own, and one problem never holds up the others. This one seems to make several separate changes:

  • Change report redaction: scrub home, email and username before the long-value and secret pass, and add more home path forms
  • Update legacy profile and Windows updates test expectations to compare against resolved paths

Could you open a pull request for each?

One way to split it: Open one pull request for the redaction change (src/steve_desktop/diagnostics.py and tests/test_desktop_feedback.py) and a second for the test expectations (tests/test_legacy_profile.py and tests/test_windows_updates.py). We'll leave this one open until then.

@M3NT8L-One

Copy link
Copy Markdown
Contributor Author

Split per @10-X-eng's request into two PRs off current main:

Both are standalone. This PR can close once those two are up; happy to adjust either if anything looks off.

10-X-eng pushed a commit that referenced this pull request Nov 6, 2026
On Darwin, /tmp and /var resolve under /private, so migrate_profile and
pending return resolved Paths. Match the test expects. Split from #18.
10-X-eng pushed a commit that referenced this pull request Nov 6, 2026
* Redact home paths before long-value scrub (macOS /private)

Apply email/home/username redaction before the ≥80-char wipe, and keep
both lexical and resolved (/var vs /private/var) home forms so long temp
paths become [home] instead of [long value omitted]. Split from #18.

* Redact known secrets before home, email and account-name passes

Changing part of a secret first (an account name inside a token) left the
rest of it in the report. Secrets now go first; the long-value wipe still
runs last.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: steve-maintainer <noreply@anthropic.com>
@10-X-eng

10-X-eng commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Closing, because this was split into #22 and #23, which are both merged. Thanks!

@10-X-eng 10-X-eng closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants