Skip to content

ci(BS-015): scan every tracked Cargo.lock - #703

Open
lazyxeon wants to merge 2 commits into
mainfrom
cursor/scan-all-cargo-locks-f4f4
Open

lazyxeon wants to merge 2 commits into
mainfrom
cursor/scan-all-cargo-locks-f4f4

Conversation

@lazyxeon

@lazyxeon lazyxeon commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Gate: Cargo Deny Check and Security Audit (cargo-audit) now scan every tracked Cargo.lock.

Fixes #701

Description

cargo audit and cargo deny were resolving the root lock only. tools/parse_probe is its own workspace, and both fuzz crates keep their own locks, so those files never failed the pull-request gate.

scripts/ci/scan_cargo_locks.sh discovers locks with git ls-files -- '**/Cargo.lock' 'Cargo.lock'. The **/ spec matches nested locks only; the root spec is separate. The security-audit jobs, the daily dependency-management audit, and the Aravath supply-chain job all call that script. scripts/ci/test_workflow_policy.py fails if a tracked Cargo.lock is not scanned. The negative case drops the nested pathspec, drops the root pathspec, filters one lock out with grep -v, replaces the per-lock cargo audit --file with a bare cargo audit, and ignores a failure with || true and continue-on-error.

Lockfiles

  • Cargo.lock (unchanged)
  • tools/parse_probe/Cargo.lock
  • astraweave-ecs/fuzz/Cargo.lock
  • crates/astraweave-blend/fuzz/Cargo.lock

Advisories fixed

No new RUSTSEC ignore.

tools/parse_probe:

  • RUSTSEC-2026-0007 bytes 1.10.1 → 1.12.1
  • RUSTSEC-2026-0441 pin-utils 0.1.0 removed by futures-util 0.3.31 → 0.3.34
  • RUSTSEC-2026-0190 anyhow 1.0.100 → 1.0.104
  • RUSTSEC-2026-0097 rand 0.9.2 → 0.9.5 (rand 0.8.5 left the graph)
  • RUSTSEC-2026-0386 tokio 1.47.1 → 1.54.1

astraweave-ecs/fuzz:

  • RUSTSEC-2026-0190 anyhow 1.0.100 → 1.0.104
  • RUSTSEC-2026-0097 rand 0.9.2 → 0.9.5

crates/astraweave-blend/fuzz:

  • RUSTSEC-2026-0007 bytes 1.11.0 → 1.12.1
  • RUSTSEC-2026-0190 anyhow 1.0.100 → 1.0.104
  • RUSTSEC-2026-0097 rand 0.8.5 → 0.8.8
  • RUSTSEC-2026-0386 tokio 1.48.0 → 1.54.1 (cargo update -p tokio stopped at unpatched 1.50.0; --precise 1.54.1 is the patched release)

The nested locks were also refreshed to the graph cargo deny resolves from the current path manifests (parse_probe gained the url/icu stack; blend fuzz gained the image/rav1e stack, including paste 1.0.15, which is the existing RUSTSEC-2024-0436 ignore). No Cargo.toml dependency was added. The root Cargo.lock is unchanged.

Type of change

  • Security enhancement

Security Considerations

  • No new Cargo.toml dependency. Newly locked crates are transitive deps the path manifests already required.
  • User input, authentication, sensitive data, and network protocols are unchanged.

Report

  1. Head SHA: 5a0e6c5984a26c074a83bde27add96a34fdfd903. Required checks have not been reported on this SHA yet.
  2. Commands:
    • python3 scripts/ci/test_workflow_policy.py exit 0 (40 tests)
    • bash scripts/ci/scan_cargo_locks.sh audit exit 0
    • bash scripts/ci/scan_cargo_locks.sh deny exit 0 (four times advisories ok, bans ok, licenses ok, sources ok)
    • bash scripts/ci/scan_cargo_locks.sh audit --format json exit 0
    • bash scripts/ci/player_facing_names.sh exit 0
    • git diff --exit-code -- Cargo.lock exit 0
  3. Not run: determinism replay (root Cargo.lock and hashed crates unchanged). aw_trace_sync --check (diff does not touch CLAUDE.md, docs/architecture/, or a Cargo.toml). GPU frame budget (not a render change; this host cannot measure the 1660 Ti).
  4. Measurements: not measured.
  5. Replay hashes: unchanged. Root Cargo.lock was not edited.
  6. Deferred issue links: none.
Open in Web Open in Cursor 

cursoragent and others added 2 commits November 6, 2026 12:58
bytes 1.10.1 and 1.11.0 were RUSTSEC-2026-0007. futures-util 0.3.34
drops pin-utils (RUSTSEC-2026-0441). anyhow, rand, and tokio move to
the patched releases those scans reported. The root Cargo.lock is
unchanged. The nested locks also record the graph cargo deny resolves
from the current path manifests.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
cargo audit and cargo deny were resolving the root lock only.
scan_cargo_locks.sh discovers locks with git ls-files, including the
nested spec that does not match the root file. The policy test fails
when a tracked lock is dropped or a scan failure is ignored.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 12:58
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T13:01:17.372479Z 5a0e6c5 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a clearance at 5a0e6c5984a26c074a83bde27add96a34fdfd903. The scanner does reach all four tracked locks, and the nested lock updates are what make that pass. Deny does not assert the committed lock.

git diff 7ea1d200d88f9a7df6e7dbe19430082ff85098c4...HEAD -- Cargo.lock is empty. The diff does not touch a hashed crate, deny.toml, or .cargo/audit.toml. No new ignore. No git source and no openssl / openssl-sys in the three nested locks. Registry packages in those locks have checksums. The versions I checked on crates.io are not yanked, and the highest rust-version among them is 1.88 (image 0.25.10, icu_* 2.4.0), under the 1.89.0 pin.

cargo metadata --locked exited 0 for tools/parse_probe, astraweave-ecs/fuzz, and crates/astraweave-blend/fuzz. bash scripts/ci/scan_cargo_locks.sh deny exited 0 (four times advisories ok, bans ok, licenses ok, sources ok) and left the tree clean. bash scripts/ci/scan_cargo_locks.sh audit exited 0 (36, 1149, 171, and 147 crate dependencies). python3 scripts/ci/test_workflow_policy.py exited 0 (40 tests). bash scripts/ci/player_facing_names.sh exited 0.

The parent locks are not clean. cargo audit --file on 7ea1d200's blend and parse_probe locks exits 1 on RUSTSEC-2026-0007 (bytes 1.11.0 and 1.10.1; patched is >= 1.11.1, and this PR has 1.12.1). The same command on the old ecs lock exits 0: anyhow, rand, and tokio are unsound warnings. cargo deny check advisories on the old blend lock exits 1 (bytes). On the old parse_probe lock it exits 1 (RUSTSEC-2026-0190, RUSTSEC-2026-0007, RUSTSEC-2026-0441). On the old ecs lock, without --locked, it rewrites the file and exits 0.

Outside .cargo/audit.toml, the new blend lock warns only on the existing ignores RUSTSEC-2024-0436 (paste 1.0.15) and RUSTSEC-2025-0141 (bincode). cargo tree -p image for the blend fuzz workspace shows image 0.25.10 with features exr, hdr, jpeg, png, rayon and does not link ravif. Root still has image 0.25.8 and tokio 1.53.3. Tokio 1.54.1 is inside the patched range for RUSTSEC-2026-0386 (>= 1.53.3) and is not yanked. That float is wider than the advisory bumps. It is not a second gate failure on the versions above.

git ls-files on git 2.43.0 matches the comment: **/Cargo.lock is the three nested locks, and Cargo.lock is the root file only.

  1. Head 5a0e6c5984a26c074a83bde27add96a34fdfd903. Required checks were still pending (Cargo Deny Check, Security Audit, Gate, replay hash). Not green.
  2. Commands: policy test exit 0; scan_cargo_locks.sh deny exit 0; scan_cargo_locks.sh audit exit 0; player_facing_names.sh exit 0; cargo metadata --locked exit 0 on each nested manifest; cargo deny --locked on the current ecs fuzz manifest exit 0 and on the parent ecs lock exit 1.
  3. Not run: determinism replay (root Cargo.lock and hashed sources unchanged). aw_trace_sync --check (diff does not touch CLAUDE.md, docs/architecture/, or a Cargo.toml). GPU frame budget (not a render change; this host cannot measure the 1660 Ti).
  4. Measurements: not measured.
  5. Replay hashes: expected unchanged. Root Cargo.lock matches 7ea1d200. Not re-run.
  6. Deferred issue links: none.

scripts/dev.sh security_audit still runs bare cargo audit / cargo deny check and returns 0 either way. That helper is outside this gate.

Open in Web View Automation 

Sent by Cursor Automation: ASTRA PR AUDIT AGENT

fi
echo "::group::cargo deny ${lock}"
# Extra args are check options (for example --hide-inclusion-graph).
cargo deny --manifest-path "$manifest" check "$@" bans sources advisories licenses

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo deny here does not pass --locked, so a stale lock is rewritten and then approved.

I copied astraweave-ecs/fuzz/Cargo.lock from 7ea1d200 over the file in this PR and ran cargo deny --manifest-path astraweave-ecs/fuzz/Cargo.toml check advisories. Exit 0. The only lock change was adding the path package astraweave-profiling 0.4.0. anyhow stayed 1.0.100 and rand stayed 0.9.2, and the command still printed advisories ok. The same command with --locked exits 1 (the lock file ... needs to be updated but --locked was passed) and does not rewrite the file. This PR's ecs lock accepts --locked (exit 0, advisories ok).

The runner discards that rewrite, so the deny job is not a check of the committed bytes. cargo audit --file is. Audit's default exit status does not fail the unsound advisories: the parent ecs lock audits exit 0. A nested lock can drift, deny can rewrite it into a passing graph, and both jobs stay green.

Use cargo deny --locked --manifest-path "$manifest" check "$@" bans sources advisories licenses. --hide-inclusion-graph still belongs to check, which is what aravath-windows.yml passes through. The three nested locks in this PR already satisfy --locked (cargo metadata --locked exited 0 for each). The policy helper below accepts this line without --locked, so the flag needs an assertion or the next deletion will not fail the test.

else:
uses_lock = (
'manifest="$(dirname -- "$lock")/Cargo.toml"' in code
and 'cargo deny --manifest-path "$manifest" check' in code

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper reports full coverage when two substrings are present and the git ls-files specs, minus a quoted grep -v, name every tracked lock. It does not run the script. These edits still produce an empty missing list, so test_every_tracked_cargo_lock_is_scanned stays green:

  • locks=(Cargo.lock) on the line before for lock in "${locks[@]}"
  • cargo audit --file "$lock" "$@" || exit 0
  • a pipe to grep -v tools/parse_probe/Cargo.lock with an unquoted pattern (_GREP_V_RE only matches quoted grep -v)
  • sort -u | head -n 1
  • sort -u | sed '/fuzz/d'

Replacing the final exit 1 of the Aravath deny retry with exit 0 also yields no cargo_lock_scan_gaps. The mutations this test already performs (drop one pathspec, quoted grep -v, bare cargo audit, || true, continue-on-error) do fail, and the suite exited 0 (40 tests).

The deny arm also matches cargo deny --manifest-path "$manifest" check with or without --locked. The rewrite in the scanner comment is invisible here. scripts/ci/scan_cargo_locks.sh says the policy test fails if a tracked lock is left out. That holds for the cases above only.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

5 open issues
What changed in this PR

Updates CI security gates so cargo audit and cargo deny scan every tracked Cargo.lock (root + nested workspaces/fuzz crates), and adds a policy test to prevent regressions.

Changes:

  • Add scripts/ci/scan_cargo_locks.sh to discover and scan all tracked lockfiles for audit and deny.
  • Update GitHub workflows to call the script instead of scanning only the root lock.
  • Extend scripts/ci/test_workflow_policy.py to enforce that all tracked lockfiles are scanned and that workflows don’t weaken the gate.
File Description
scripts/​ci/​test_workflow_policy.py Adds policy checks ensuring workflows and the scanner cover every tracked Cargo.lock.
scripts/​ci/​scan_cargo_locks.sh New shared scanner that iterates all tracked lockfiles and runs cargo audit / cargo deny per lock.
docs/​current/​CI_ARCHITECTURE.md Updates CI architecture docs to reflect the new shared scanning script usage.
.github/​workflows/​security-audit.yml Switches security audit jobs to use scan_cargo_locks.sh for deny/audit.
.github/​workflows/​dependency-management.yml Switches scheduled audits/deny to use the shared scanner (including the json report step).
.github/​workflows/​aravath-windows.yml Switches Aravath supply-chain job deny/audit invocations to the shared scanner (with retries).

Review effort: Lite

echo "### Security Audit Results" >> audit-report.md
echo '```' >> audit-report.md
cargo audit --format json >> audit-report.md 2>&1 || true
bash scripts/ci/scan_cargo_locks.sh audit --format json >> audit-report.md 2>&1
Comment on lines +34 to +36
echo "::group::cargo audit ${lock}"
cargo audit --file "$lock" "$@"
echo "::endgroup::"
r"git\s+ls-files\s+--\s+(?P<specs>(?:'[^']*'|\"[^\"]*\")(?:\s+(?:'[^']*'|\"[^\"]*\"))*)"
)
_GREP_V_RE = re.compile(
r"grep\s+-v(?:\s+-[EF])?\s+'([^']+)'|grep\s+-v(?:\s+-[EF])?\s+\"([^\"]+)\""
Comment on lines +375 to +380
def _uncomment(script: str) -> str:
kept: list[str] = []
for line in script.splitlines():
if line.lstrip().startswith("#"):
continue
kept.append(line.split("#", 1)[0])
Comment on lines +440 to +443
def cargo_lock_scan_gaps(workflow_text: str, scanner_text: str) -> list[str]:
"""Gaps in one workflow. Empty means every audit/deny step scans every lock."""
gaps: list[str] = []
tracked = tracked_cargo_locks()

lazyxeon commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Devastation (T3 D-CI + D-DEPS) @ 5a0e6c59: no new findings; #701 is fixed. Non-blocking.

  • Reproduced on base 7ea1d200: the root-only cargo audit and cargo deny runs exit 0 while missing nested failures. Those include tools/parse_probe (RUSTSEC-2026-0007 bytes, unsound anyhow, unmaintained pin-utils) and crates/astraweave-blend/fuzz (RUSTSEC-2026-0007 bytes 1.11.0).
  • This PR: scan_cargo_locks.sh audits and denies all four tracked locks with 0 vulnerabilities and no warnings. It adds no new ignores, and the root lock, deny.toml and .cargo/audit.toml are unchanged.
  • Policy and mutant tests: policy tests pass (40). Dropping the **/Cargo.lock pathspec or the root Cargo.lock pathspec both get caught by the new tests.

Report: https://cursor.com/agents/bc-5bcea109-f11a-545c-a21c-7cf6c8f36cd0

This branch has not been deployed

No deployments
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.

[annubis][medium][D-DEPS] tools/parse_probe/Cargo.lock carries RUSTSEC-2026-0007 + pin-utils; nested locks unscanned (main @ d01720a8)

3 participants