Repository navigation
fix(fixture): redact device identifiers from shared bundles - #66
Merged
Merged
Conversation
capcut fixture is documented as producing a shareable bundle and the generated README invites attaching it to a public issue, but the redactor only ever handled home paths and email addresses. The device_id, mac_address and hard_disk_id that CapCut stamps into every platform and last_modified_platform block were copied verbatim into draft_info.json, template-2.tmp and every nested timeline document, so following the documented flow published a stable device ID and MAC address. SANITIZE_REPORT.json compounded it: source_dir and out_dir were written raw, reintroducing the username the timeline files had just had scrubbed. The new redactor keys on the field name rather than the value shape — device_id and mac_address are plain 32-hex, so a bare hex pattern would also blank legitimate material and segment UUIDs. It matches the escaped quote form template-2.tmp uses for its string-JSON, and only non-empty values, so an already-blank hard_disk_id is not reported as removed. Keys are kept with empty values because the on-disk shape is the point of a fixture. app_id is deliberately left alone: it identifies the app, not the machine, and nothing in src/ reads it. Closes #59
The new tests synthesised a /home/<user>/ prefix so the report's source_dir had something for the path redactor to catch. On Windows join() produces ...\home\secretuser\..., which the POSIX linux_user pattern cannot match, so the windows-latest smoke failed. Production was never affected: a real Windows project lives under C:\Users\<name>\, which windows_user already covers. The synthetic prefix was the only thing unredacted. Windows now asserts against the real account name from tmpdir() instead — that path is genuinely C:\Users\<user>\AppData\..., so the platform that exposed the gap ends up exercising the production shape rather than a synthetic one. The username assertions are skipped only if tmpdir() is not under a Users\ root at all.
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.
Closes #59.
capcut fixtureis documented as producing a shareable bundle and the generated README tells users to attach it to a public issue — but the redactor only handled home paths and emails.device_id,mac_addressandhard_disk_idwere copied verbatim, so the documented flow published a stable device ID and MAC to a public repo.SANITIZE_REPORT.jsoncompounded it by writingsource_dir/out_dirraw, reintroducing the username the timeline files had just had scrubbed.Approach
Keyed on the field name, not the value shape —
device_idandmac_addressare plain 32-hex, so a bare/[0-9a-f]{32}/would also blank legitimate material and segment UUIDs. Handles the escaped-quote formtemplate-2.tmpuses for its string-JSON. Matches only non-empty values, so an already-blankhard_disk_idis not counted as a removal. Keys are preserved with empty values — the on-disk shape is what a fixture is for.app_idis deliberately left alone: it identifies the app, not the machine, and nothing insrc/reads it. Happy to include it if you'd rather.Tests
Four new cases: plain and escaped forms, a sweep asserting no identifier survives in any emitted file (report and README included), report path redaction, and an exact redaction count that proves the blank
hard_disk_idis not over-reported.651 tests pass, biome clean.
/cc @scornik — this is the fix your 8.5.0 bundle was waiting on.