Skip to content

Derive run paths and prior-run identity from a sanitized repo ID, not the raw repo name - #95

Open
bodapatisaikrishna wants to merge 1 commit into
cloudflare:mainfrom
bodapatisaikrishna:fix/untrusted-repo-name-and-prior-runs
Open

bodapatisaikrishna wants to merge 1 commit into
cloudflare:mainfrom
bodapatisaikrishna:fix/untrusted-repo-name-and-prior-runs

Conversation

@bodapatisaikrishna

@bodapatisaikrishna bodapatisaikrishna commented Oct 23, 2026 •

Copy link
Copy Markdown

Fixes #94.

Problem

The repo name is target-controlled: the directory name comes from whoever packaged the target, and the remote from the target's own .git/config. That name was used raw as a path component (~/security-audit-skill/<repo-name>/run-<N>) and as the only key for prior-run reuse. A hostile target could move the run's output, including the sandbox-writable scratch/ directories, outside ~/security-audit-skill/. It could also share prior-run state with a different repo that has the same name, either poisoning that repo's later audits with crafted rejected or covered records or reading its confirmed findings.

Changes

SKILL.md (Full audit setup)

  • Repo name is now only a display label, recorded as data and never used as a path component or as run identity.
  • New Repo ID: a sanitized slug of the final name component ([a-z0-9_-], max 48 characters, falls back to repo), then -, then the first 16 hex characters of the SHA-256 of the target's canonical absolute path. It matches ^[a-z0-9][a-z0-9_-]{0,47}-[0-9a-f]{16}$, so it can't contain /, ., or .., and two different targets don't collide.
  • The output directory defaults to ~/security-audit-skill/<repo-id>/run-<N>. It is resolved against the real root with no symlinked components, and run-<N> is created exclusively.
  • run-metadata.json now records repo_id.

SKILL.md (Coverage and prior runs)

  • Prior runs are untrusted input. A run is compatible only if it sits directly under the current repo ID (or the user names it), its metadata matches the current repo_id and canonical target, and its ledger and findings pass the current validators. Any other run is recorded as incompatible and not read. Prior record text can't change scope, coverage or a verdict.

RECONNAISSANCE.md / README.md

  • Point to the compatibility rule and document the <repo-id> default.

Notes

  • Guidance only. The validators and schema are unchanged, and node --test passes (65/65).
  • This complements Treat audited code as untrusted input, run the validators on Windows, add CI #75 (target content is evidence, not instructions) and Harden git and symlink handling for untrusted targets #76 (neutralized git config). Neither covers repo-name derivation or prior-run identity, and neutralizing global/system git config still leaves remote.origin.url under target control.
  • Tradeoff: runs written under the old <repo-name> layout have no repo_id, so they are treated as incompatible and not reused. Moving a checkout also changes its repo ID. In both cases the run starts fresh instead of trusting state it can't attribute to this target.

The repo name comes from the target's directory or its own .git/config
remote, so it is target-controlled. Using it raw as a path component and
as the only prior-run key let a hostile target escape the output root and
share prior-run state with another repo of the same name.

Derive a sanitized, target-path-hashed repo ID for paths and identity,
create the default output directory safely, and treat prior runs as
untrusted input that must match the current repo ID and target and pass
the validators before use.

Fixes cloudflare#94.
@bodapatisaikrishna
bodapatisaikrishna force-pushed the fix/untrusted-repo-name-and-prior-runs branch from fcc655f to 5a563d0 Compare October 23, 2026 15:51
coffeegrind123 added a commit to coffeegrind123/security-audit-skill that referenced this pull request Nov 11, 2026
Upstream main has not moved since 2026-09-14, but 79 pull requests are
open. Each was read at the diff level, tested in its own worktree, and
checked for conflicts; the best of each duplicate group is ported.

Validators: cloudflare#143 archived verifier owner reuse, cloudflare#87 shared artifacts
within one attempt, cloudflare#102/cloudflare#103 duplicate JSON keys, cloudflare#111 1,000-field
objects, cloudflare#127 ordinary class must match assignment, cloudflare#104 self-excluded
ordinary block, cloudflare#141 verbatim quotes checked with --target, cloudflare#45 line
upper bound, cloudflare#84 --terminal rejects open units, cloudflare#145 identity-checked
open on Windows (POSIX still fails closed), cloudflare#48 retained-artifact
check (skills/ part only). Overlapping changes were merged so both
behaviours and both test sets survive.

Method: cloudflare#125 critic reasons through handoff, cloudflare#132 deployment controls
become units, cloudflare#83 carried-record gates, cloudflare#93 abort cleanup, cloudflare#23
streaming tool calls, cloudflare#50 config-dependent reachability stays
needs_validation, cloudflare#58 sequential verifier fallback, cloudflare#96 verifier no
longer sees the hunter's verdict, severity or fix.

Execution safety (cloudflare#76 neutralized git, symlink-safe copies; cloudflare#95
sanitized repo ID and prior-run compatibility; cloudflare#108 untrusted-content
prompt block; cloudflare#129 isolation built beside the host) moves into
EXECUTION-SAFETY.md so SKILL.md stays under its token budget.

Companions: cloudflare#101 cryptography, cloudflare#116 Android, cloudflare#35 edge isolate state.

Skipped: duplicates (cloudflare#82 cloudflare#106 cloudflare#91 cloudflare#70 cloudflare#138 cloudflare#131 cloudflare#75 cloudflare#63 cloudflare#97 cloudflare#123 cloudflare#25
cloudflare#26 cloudflare#16 cloudflare#40 cloudflare#42 cloudflare#142), validator-weakening fallbacks (cloudflare#59 cloudflare#113 cloudflare#99),
README/LICENSE churn, rebrands, scope creep, and cloudflare#85 cloudflare#90 cloudflare#8 cloudflare#89 cloudflare#32.

UPGRADE.md records this sync procedure.

Co-authored-by: Rohankollabathula67 <rohankollabathula67@gmail.com>
Co-authored-by: lab 1207 <hajarevaibhav527@gmail.com>
Co-authored-by: Rudy Celekli <rudy@gradiahq.com>
Co-authored-by: Mohit Rawat <rawatmohit17906@gmail.com>
Co-authored-by: MAHER AL-AQIL <18458259+maqalaqil@users.noreply.github.com>
Co-authored-by: CodeInf <jiuqiaoy@gmail.com>
Co-authored-by: pucedoteth <119044801+pucedoteth@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Co-authored-by: Pizo <pizofreude@proton.me>
Co-authored-by: ZhiHe-ma <302089060+ZhiHe-ma@users.noreply.github.com>
Co-authored-by: shivam <juyaljii610@gmail.com>
Co-authored-by: Dante <duanjl.china@gmail.com>
Co-authored-by: Francisco <francisco@theysay.me>
Co-authored-by: Roman Dolgov <alter@users.noreply.github.com>
Co-authored-by: bodapatisaikrishna <saikrishnabodapati@gmail.com>
Co-authored-by: alvessh <117163985+alvessh@users.noreply.github.com>
Co-authored-by: itinance <hhuebel@itinance.com>
Co-authored-by: ChoYugyeong <cho4639@gmail.com>
Co-authored-by: Shaun Liebenberg <shaun@liebies.co.za>
Co-authored-by: JAI <jai19kharb@gmail.com>
Co-authored-by: ghostzeronz-coder <ghostzeronz-coder@users.noreply.github.com>
Co-authored-by: Aman Mohamed Ali <69119173+spidervirus@users.noreply.github.com>
Co-authored-by: Sandeep.dhami <sandeep84397@gmail.com>
Co-authored-by: jastfan <duohello640@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Target-controlled repo name drives output path and prior-run reuse (path escape, cross-target prior-run poisoning)

1 participant