Repository navigation
fix(mac): scrub every held secret from the support bundle - #1267
Draft
iamfatness wants to merge 13 commits into
Draft
iamfatness wants to merge 13 commits into
iamfatness wants to merge 13 commits into
Conversation
…ort bundle The known-literal layer omitted the SRT passphrase and Stream ID, the Zoom OAuth tokens, join-link passcodes and the control API token, and matched a literal only as typed, so JSON-escaped and URL-encoded copies survived. Dictionary keys were not scrubbed, overlapping literals left a remainder, the manifest was never re-checked, and the headless export had no literals. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the bundle scrub - NFC, NFD, mixed and partly composed spellings of a held secret match, in every escaped form; the scanned text is never normalized. - Include the destinations frozen at Start, the Zoom secrets the core reads from the environment, ?pwd= on any host or in a pasted invite, the HLS URL. - Do not blank long diagnostic dictionary keys; skip a Stream ID that is one of the bundle's own words. - Anchor the someKey=value rule to the start of a run: it was quadratic. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Only a valid HLS playlist URL is a literal (a half-typed one disabled the user:password rule), plus its path/stem prefix as the core does. - Keep every destination streamed this session, so Stop does not forget it. - Cut join-link passcodes free of surrounding punctuation; handle & and wrapped links. - Make the JWT rule linear without changing its matches. - Cover secrets whose first character is escaped. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Drop the opaque-token exemption for keys: no real diagnostic key has that shape, and an unheld token used as a key survived. - Run Foundation's literal replace after the matcher, as main did: it also equates singleton code points in the text. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ives up - On a line with a literal hit, remove the union of: every literal occurrence, what the rules remove from the untouched text, and what a plain replace followed by the rules removes. A literal can no longer take away the anchor a rule needs. - ICU gives up silently on very long segments: drop the whole string then. - Keep the as-held form beside the trimmed one; hold an HLS path only when it has a distinctive part; decode pasted links word by word. - Tests compare against a verbatim copy of main's redactor, with a seeded random differential. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…iteral - Pass the list the bundle has always replaced through as a floor, replayed exactly: the output can then never show more than before, whatever the longer list or the other views do. - Run the rules on text with every secret spelling removed, so a rule an escaped secret had stopped reaches its neighbour. - A literal holding U+0000 (from ?pwd=...%00) crashed the export. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Main matched such a value only in its whole-file pass; a rule taking part of it in the per-line pass left a rest that pass no longer recognised. Tests now compare markers by code unit, not by grapheme. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…k line a literal - A line under 4 characters of a multi-line secret stayed once its other line was replaced, which main's whole-file pass would have removed. redactLines now searches the whole text first and gives each line its share. - A whitespace-only line (or NUL piece) became a literal and shredded all indentation and the pretty-printed JSON. - The differential against main now covers multi-line secrets with short and blank lines. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Splitting it on U+0000 (to keep it away from Foundation's search, which traps) lost the match main made when the pieces were short. The whole value now goes to the byte matcher only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Replaying the NUL-split sides could remove an anchor main's rules still saw, and a whole NUL value never reached Foundation's search. It now does, only through the bounds-checked occurrences(). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes secret scrubbing in the macOS support bundle only. No crash report, crash upload or telemetry-sending code (#1254 is untouched).
Leaked on main (each proven by a failing test with fake secrets)
As free text in logs, warnings or snapshots (shapes the pattern rules cannot know):
Also:
manifest.txt, which was never re-checkedsomeKey=value, JWT) let one long unbroken line stall the exportChange
SupportBundleSecretsis the single list of held secrets. It covers the editable and every streamed destination (Stop does not forget them), meeting passcodes on any host, the Zoom, YouTube and Twitch sign-ins, the Zoom environment secrets the core inherits, the control token, and a valid HLS ingest URL.LiteralScrubbermatches each character raw, percent-encoded, JSON-escaped (nested) or in a canonically equivalent Unicode spelling. It is a state-set matcher, not a regex, and never normalizes the scanned text.?pwd=...%00) no longer crashes the export. It is still matched whole, through a bounds-checked search; its long enough sides are literals too, and the floor stays main's list unchanged.Known residuals
"Never less than main" rests on construction plus testing, not a proof. The floor view uses a tracked replay of main's replace and the rewritten (equivalent in differentials, now linear) rules, and the whole-file final pass is not a replay of main's. The reviewer found no case of visible text main removed with single-line secrets. A multi-line secret that does not appear intact (log line prefixes, LF against CRLF, a tail cut inside it, an indented line logged without its indent) can leave short or indented lines. One random NUL/U+FEFF/U+200D sample left an extra invisible U+FEFF that belongs to neither secret; not diagnosed.
Secrets changed, cleared, rotated or signed out earlier (other than streamed destinations) are not literals. The shell log persists across launches.
Values under 4 characters, and Stream IDs under 6 characters or equal to a common word, are not matched.
Encodings not matched: JSON-escaped then URL-encoded, form
+encoded twice, HTML entities, singleton code points that only a non-held spelling would produce (except where Foundation's search equates them).Per-join ZAK, OAuth broker token and Twitch device code are not retained, so only pattern rules cover them.
Pre-existing: the final pass edits JSON files as text, so a numeric secret can make invalid JSON; a log tail with no newline keeps its partial first line.
A plain-word secret that is not excluded can over-redact diagnostics.
The headless export now reads the app's own Keychain items; a differently signed build could be prompted.
Test plan
bundle-secrets/*cases, fake secrets and in-memory Keychain only; the first set was red on unfixed main (105 failures)92893f42, then 10 on the multi-line fix and 6 on the NUL follow-ups, each red once its test gap (two survivors) was closed. The earlier set was not rerun after the last changes. The quadraticsomeKey=valuemutation last ran on an earlier commit (73 s against a 5 s limit).m4aduration cases. One earlier run also failed the audio sync nudge case, which alone then failed 1 of 3 runs (flaky)81107b6aorigin/main(docs only)🤖 Generated with Claude Code