fix(policy): CHECK 15 safe-shape allowlist with fail-closed traversal - #378
Merged
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d173d3dcd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Step over CommonMark backslash escapes before any CHECK 15 safe shape is tried, so an escaped backtick or ] no longer opens a span that exempts the tracker reference behind it. An escaped # stays a candidate. Adds two-direction detection canaries for the escape rule.
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
Rewrites
tools/policy_check.shCHECK 15, the tracker-reference guard overplugin/**/*.mdandplugin/workflows/*.json. The old check deleted known-harmless patterns and flagged what remained. The new check allows only listed safe forms, and it fails closed when it cannot find or read a file.Closes #371.
Detection
CHECK15_CLASSIFY_AWK, a single POSIX awk walker, is now the only place classification happens.#followed by a digit run is a candidate, with no condition on the next character. It becomes a finding unless one of exactly four safe shapes consumes it whole:owner/repo#Ncitation at a word boundary](#...)in-page anchorissue#123,PR#456,_#123_,__#123__,#123_,#123g.Traversal
-type fis removed.find -print0results are read into an array. The stream ends with a sentinel record carryingfind's exit status, so a failed or truncated discovery becomes a finding.-fand-r, and the awk exit status is checked.Canaries
tracker-ref-allowlist-canary.md, and a committed symlink fixture,tracker-ref-symlink-canary.md.CHECK 15 TRAVERSAL CANARY: covers discovery failure, the directory gate, a missing path, awk status, the pinned find-args arrays, and the symlink probe with a-type fnegative control.tests/policy/safety-tracker-ref-guard.jsonpins the new banner, and its description now matches the shipped behaviour.Validation
bash tools/validate.sh --changed: atools/**edit escalates this to the full suite, which passed at0d173d3.bash tools/validate.sh --self-test: all pass.tools/policy_check.sh --strict: Checks passed 72/73 (the one failure predates this PR), 29 findings all allowlisted, 0 new.plugin/content: 0 new findings.Local review
-type fin discovery. Both behaviours existed onmainbefore this PR, but this PR's comments claimed nothing slipped through. Fixed structurally in8bc8ecfby making the candidate unconditional and discovery name-only.-L. Declined as a recorded residual in CHECK 15's header comment. This behaviour is inherited and applies to every discovery site in the script, andplugin/has no symlinks today. The script-wide fix is tracked in policy_check.sh discovery silently skips symlinked directories and non-regular name matches #377.Versioning
No bump. The changes are confined to
tools/,tests/andCHANGELOG.md([Unreleased]), none of which ship in the plugin.Known residuals (stated in the CHECK 15 header)
#plus digits prefix.#12ab).core.symlinks=true. A checkout without symlink support fails loudly rather than passing silently.