Repository navigation
fix(vuln-poc-gate): a PoC must live in the PoC dir, and files it creates count as mutation - #1218
Merged
Merged
Conversation
…tes count as mutation The gate checked the spelled path of the PoC against the PoC dir with a prefix match, so $POC_DIR/../x.sh passed, and a link inside the dir to a script elsewhere passed too. It now compares canonical directories and refuses a linked file. Command mode checked the target for changes with git diff, which cannot see a file the script creates, so a PoC that wrote into the target still verified; it now compares the full status, untracked files included, before and after the run.
…nk reason, untracked wording - After the PoC runs, a HEAD that moved off the audited commit now fails as target-mutated (both modes), with a test. - A symlinked script or test file reports script-is-symlink / test-file-is-symlink instead of outside-poc-dir. - Comment now says the status check sees untracked, non-ignored files only. - PoC env sets PYTHONDONTWRITEBYTECODE=1; SKILL.md tells the scanner to keep fixtures in a mktemp -d dir outside the clone. Co-Authored-By: Claude <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.
vuln-poc-gate.shis the evidence gate for HIGH/CRITICAL findings, so what it accepts as a PoC matters. two ways around it:POC_DIRby a prefix match on the spelled path.$POC_DIR/../x.shpassed, and so did a link insidePOC_DIRto a script elsewhere, so a script from outside the PoC dir ran and was recorded as the verifier.git diff/git diff --cached, which cannot see a file the script creates. a PoC that wrote into the target checkout still came outverified.changes (
scripts/vuln-poc-gate.sh)poc_filecanonicalises the file's directory andPOC_DIR(pwd -P), requires the file to sit under it, and refuses a file that is itself a link. both the command script and the foundry test file go through it, and the canonical path is what runs / is copiedgit status --porcelain --untracked-files=allbefore the run and compares it after, on top of the existing diff checks. files that were already untracked do not count; new ones fail the run astarget-mutated(exit 21)tests (
test_vuln_poc_gate.sh):..escape is refused and the script does not run; a link in the PoC dir is refused; a script behind a linked directory is refused; a PoC that creates an untracked file fails with exit 21; a pre-existing untracked file does not break verification. four of the five new checks fail on main (the pre-existing-file one is a guard that passes on both). the suite passes in full; shellcheck has nothing at error severity andscripts/lint-shell.shis clean.not covered
exit 0; requiring the script to print a marker would make a careless PoC fail but not a deliberate one, and it changes what vuln-scanner writes, so i left it as a question for you.HOME; on a runner that holds no credential files there this is low, but a laptop run could read them.git diffonly: forge writescache/andout/into the checkout, so the untracked comparison would need an allowlist for those.live_vuln_poc_gate.shneeds network and was not run.