Repository navigation
Conversation
`trap.d/804.edit-op-defaulted-to-main-clone-not-worktree.md` named this maintainer's actual local paths at two lines describing a general class of trap (an unprefixed supertool edit landing in the wrong tree). Replace both with generic placeholders (`<worktree>`, `<main clone>`) already used elsewhere in the same fragment, so the file still teaches the lesson without disclosing one person's disk layout. Adds tests/test_trap_fragment_no_leaked_home_paths_822.py as a regression guard over the whole trap.d/ directory, with a positive control proving the detector actually flags a real leaked path and does not just pass by accident. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…lash form Self-review (Explore reviewer) found the new regression guard's HOME_PATH_RE required a trailing slash after the username segment, so a bare `/Users/floriandavid` with no further path component would silently pass. Widen the pattern to also match at a word boundary. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This was referenced Sep 27, 2026
fdaviddpt
added a commit
that referenced
this pull request
Sep 27, 2026
… files (#826) * fix(#825): scrub the real path/username PR #824 reintroduced into two files PR #824 (merged as 379f712) fixed #822 by scrubbing a leaked local checkout path out of trap.d/804.edit-op-defaulted-to-main-clone-not-worktree.md, but put the same real maintainer path/username back into two other tracked files it added in that same commit: - changelog.d/822.fixed.md's own prose quoted the literal /Users/floriandavid/... path it was describing the scrub of. - tests/test_trap_fragment_no_leaked_home_paths_822.py's docstring, regex comments and positive-control fixture all spelled out the same real path. Both now use a generic made-up path/username (/Users/someone/...) instead. The positive-control fixture keeps the same shape (an absolute POSIX home path under a worktree directory naming issue #804), so it still exercises the detector's regex identically -- only the value is fake now, not the shape. tests/test_no_real_home_paths_467.py::test_no_tracked_file_leaks_the_current_machine_username was red before this change (found floriandavid in exactly these two files) and is green after. Co-Authored-By: Claude Sonnet 5 <[email protected]> * trap(#825): log the CI-skip gap that let #822's own fix reintroduce a real username Not a code fix -- a trap.d fragment for the curation pass, per the developer brief's "log it and carry on" for something observed but not decided: tests/test_no_real_home_paths_467.py's username scan skips itself under CI (by design, to avoid false positives on CI runner account names like runneradmin), so this whole class of leak only surfaces on a maintainer's own local run. #822's own fix (PR #824) already shipped this exact shape once, and #825 is a second occurrence. Deciding what to do about it -- new jit-context rule, filed issue, or leave as-is -- is left to the curation pass, per this issue's own text. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Sep 28, 2026
…tial) (#840) * fix(#835): add a CI-safe recurrence guard for previously-leaked values `tests/test_no_real_home_paths_467.py`'s username detector (detector 2) is deliberately skipped on CI (#472) because there is no general, CI-safe way to tell a contributor's real leaked username apart from a CI provider's own runner account name. #835 reports the side effect: this class of regression can merge to main with a fully green CI run, and #822's own fix (PR #824) demonstrated it -- it scrubbed the file the issue named but reintroduced the same real value into two other files the same commit added, with CI green throughout; #825 repeated the identical shape. Add detector 3: an unconditional, CI-safe hash-based regression guard. `_KNOWN_LEAK_HASHES` holds the SHA-256 hex digest of any value already confirmed to have leaked (never the plaintext); `_known_leak_offenders` scans every git-tracked file for a token matching one of those hashes. It carries none of detector 2's false-positive risk because it depends on neither `CI`/`GITHUB_ACTIONS` nor `getpass.getuser()`, so it runs everywhere, including CI, and would have caught #822's reintroduction into a different file. This does not solve #835's general question -- a genuinely new leak, never seen before, has no hash on the list yet and stays invisible to this detector by construction, so the general problem detector 2 exists for remains open. The module docstring's new "Detector 3" section documents the rationale and how to add an entry after a future incident. Ships with `_KNOWN_LEAK_HASHES` empty; two new tests (`test_known_leak_hash_detector_fires_on_a_planted_leak` and its must-not-fire pair) exercise the real matching function directly so the empty-list state cannot be mistaken for an untested one. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(#835): review round -- validate leak-hash granularity, scope claims Self-review (Explore + oss:auditor, both against 248e9d9) found a consequential gap: _KNOWN_LEAK_HASHES entries were documented as "hashlib.sha256(leaked_value.encode()).hexdigest()" with no constraint on what "the leaked value" means, but _known_leak_offenders only ever hashes the tokens _LEAK_TOKEN extracts (runs of [A-Za-z0-9_.-]). A maintainer following the old wording literally for a path-shaped leak (exactly what #822 leaked, e.g. "/Users/realname/project") would build an entry that can never match anything -- the tokenizer only ever sees "Users", "realname", "project" as separate tokens, never the whole string -- with no error to say so. That silently defeats the detector's whole purpose for the input shape its own commit message cites as motivation. Add `_leak_hash(token)`, the only supported way to build an entry now: it hashes the token like before but raises ValueError up front when the token is not already a single bare _LEAK_TOKEN unit, turning the mistake into a loud failure at add-time instead of a permanent silent no-op. Two new tests pin both directions (test_leak_hash_rejects_a_value_that_is_not_a_bare_token, test_leak_hash_accepts_a_bare_token); the existing positive/negative controls are rewired through _leak_hash so normal use exercises it too. Also: softened the "forever, on every platform" wording in the unconditional guard test's docstring and the module docstring's Detector 3 section to state the real, narrower scope precisely (exact, case-sensitive, separator-delimited recurrence only -- not a substring or case-variant match), and updated the file's stale opening summary line to mention the new detector's scope alongside the pre-existing path/username ones. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
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.
Fixes #822.
trap.d/804.edit-op-defaulted-to-main-clone-not-worktree.mdleaked this maintainer's actual local checkout paths at lines 1 and 7 (/Users/floriandavid/Documents/claude-remember-wt/804and/Users/floriandavid/Documents/claude-remember), found by the gate 3 release audit for v0.35.1. Classships-local-state, blocking unconditionally.Change
Scoped exactly as the issue asked: a small, surgical two-path replace, nothing else about the fragment's content or meaning touched.
<worktree>(matches the file's own existing line-2 placeholder convention)<main clone>(bracketed, matching the issue's own suggested form; the existing "(the MAIN CLONE)" annotation was left untouched)tests/test_trap_fragment_no_leaked_home_paths_822.py: scans everytrap.d/*.mdfor a leaked/Users/<name>/...or/home/<name>/...path, with a positive control (a synthetic pre-fix-shaped string, must be flagged) and a negative control (a synthetic placeholder-shaped string, must not be flagged)changelog.d/822.fixed.mdSelf-review finding: fixed
A reviewer caught that the test's original regex
/(?:Users|home)/[A-Za-z0-9_.-]+/required a trailing slash after the username segment, so a bare/Users/floriandavidwith no further path component would silently pass undetected -- contradicting the test's own docstring claim. Widened to/(?:Users|home)/[A-Za-z0-9_.-]+(?:/|\b)and re-verified both the fix and the existing positive/negative controls.Self-review finding: below-bar, left as-is
The parenthetical (the MAIN CLONE) on line 7 now reads as a near-verbatim echo of the
placeholder right before it -- left as-is because the issue scoped this fix to a mechanical two-path replace only, and rewording the parenthetical would be exactly the kind of extra prose change it asked me not to make.Tests
Red:
python3 -m pytest tests/test_trap_fragment_no_leaked_home_paths_822.py -q-> 1 failed, 2 passed (against the real pre-fix leaked content).Green: same command -> 3 passed. Full suite not run (change confined to one fragment plus one self-contained new test file).
[AI-generated]