Skip to content

Commit 0d2ead1

Browse files
authored
chore(vuln-scanner): stage cargo-fuzz toolchain + widen sandbox grant (#868)
Runtime-infrastructure half of the cargo-fuzz addition, split out of #863 per triage since it touches the fork's trust boundary and needs maintainer review separately from the skill-scope change. - stage-vuln-scanner.sh: install a nightly Rust toolchain + cargo-fuzz unconditionally in the pre-run staging step, mirroring the existing slither/foundry pattern (the sandbox denies toolchain installs in-run, and the scan target isn't known until Arm A picks it — the skill's own command -v + fuzz/fuzz_targets guard makes this a no-op on repos that don't ship a fuzz harness). - skill_mode.sh: grant Bash(cargo:*) to the write-tier tool allowlist. Wider than the single-purpose scanner grants beside it since `cargo fuzz run` dispatches through cargo itself — called out inline since it's a real widening of what vuln-scanner can execute. - aeon.yml: comment update describing the new staging step. Depends on the skill-scope PR (vuln-scanner: fuzz targets a repo already ships) landing first — this has no effect without the A3.5 step in SKILL.md that reaches for cargo-fuzz.
1 parent f8c5049 commit 0d2ead1

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

.github/workflows/aeon.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,11 @@ jobs:
418418
# workaround (there is no network sandbox). Installs semgrep/trufflehog/
419419
# osv-scanner/slither and appends /tmp/bin to the PATH file so the scanner
420420
# bare-names resolve in the later claude -p step and its per-call fresh shells
421-
# (an in-run `export PATH` doesn't survive between Claude's Bash calls).
421+
# (an in-run `export PATH` doesn't survive between Claude's Bash calls). Also
422+
# installs a nightly Rust toolchain + cargo-fuzz for step A3.5 (dynamic
423+
# testing) — unconditionally, like slither, since the scan target isn't known
424+
# until Arm A runs; the skill's own command -v guard makes it a no-op when
425+
# the picked repo doesn't ship its own fuzz/fuzz_targets.
422426
# Execution is separately gated by the write-tier grant in scripts/skill_mode.sh.
423427
# Best-effort: the script self-guards to vuln-scanner and never fails the run.
424428
if: steps.work.outputs.mode != '' && steps.skill.outputs.name == 'vuln-scanner'

scripts/skill_mode.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ WRITE_TOOLS="Write,Edit,Bash(gh:*),Bash(git:*),Bash(python3:*),Bash(python:*)"
4949
# a live-test showed the run logging that denial as "Blocked by sandbox". These are
5050
# read-only static-analysis tools (no repo/network mutation of their own).
5151
WRITE_TOOLS="$WRITE_TOOLS,Bash(semgrep:*),Bash(osv-scanner:*),Bash(trufflehog:*),Bash(slither:*)"
52+
# cargo (vuln-scanner Arm A, step A3.5 — dynamic testing). Staged by
53+
# scripts/stage-vuln-scanner.sh (nightly toolchain + cargo-fuzz, workflow step,
54+
# same reason as Foundry below — the sandbox denies toolchain installs in-run).
55+
# Unlike the scanners above, this is not narrow: `cargo fuzz run` compiles and
56+
# executes the cloned repo's own code, and `cargo` itself is a much wider surface
57+
# than a single-purpose analyzer. Accepted deliberately — see A3.5 in
58+
# skills/vuln-scanner/SKILL.md for the trust-boundary reasoning. The skill only
59+
# reaches for it when the clone already ships fuzz/fuzz_targets; the guard lives
60+
# in the skill, not here.
61+
WRITE_TOOLS="$WRITE_TOOLS,Bash(cargo:*)"
5262
# Foundry bare-names + the key-safe runner for deploy-uni-hook. Foundry is staged by
5363
# scripts/stage-deploy-uni-hook.sh (the sandbox denies in-run installs); the skill then
5464
# builds/simulates/broadcasts by bare name. `./hook-deploy.sh` hides the deployer key

scripts/stage-vuln-scanner.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,24 @@ else
9898
record slither skipped
9999
fi
100100

101+
# --- cargo-fuzz (dynamic testing, A3.5) — only useful when the cloned repo
102+
# already ships its own fuzz/fuzz_targets, but we don't know the target yet
103+
# at staging time (Arm A picks it after this step runs). Stage it always,
104+
# same tolerance as slither above: unconditional install, conditional use.
105+
# GHA hosted runners already have stable Rust; this only adds nightly
106+
# (cargo-fuzz needs it for sanitizer support) + the cargo-fuzz binary.
107+
if command -v cargo-fuzz >/dev/null 2>&1; then
108+
log "cargo-fuzz already present"
109+
record cargo-fuzz installed
110+
elif rustup toolchain install nightly --profile minimal >/dev/null 2>&1 \
111+
&& cargo install cargo-fuzz --locked >/dev/null 2>&1 \
112+
&& command -v cargo-fuzz >/dev/null 2>&1; then
113+
log "cargo-fuzz installed ($(cargo-fuzz --version 2>/dev/null | head -1))"
114+
record cargo-fuzz installed
115+
else
116+
log "cargo-fuzz not installed (optional — only used for repos shipping fuzz/fuzz_targets)"
117+
record cargo-fuzz skipped
118+
fi
119+
101120
log "manifest (/tmp/vuln-scan/prefetch.txt):"
102121
cat "$MANIFEST"

0 commit comments

Comments
 (0)