Repository navigation
ci: add scheduled Cargo audit workflow (#622) - #640
Conversation
|
The required This PR does not modify The failure appears to come from an updated RustSec advisory database rather than the scheduled workflow introduced in #622. I've kept the audit strict, without suppressing the advisory or introducing unrelated dependency changes. Happy to follow your guidance on whether the dependency fix should be handled separately. |
vladimirrott
left a comment
There was a problem hiding this comment.
Thanks, @Humerous. You matched npm-audit.yml closely, kept the job read-only, and the contract test covers every point in the Scope. Your comment about RUSTSEC-2026-0385 was right too: main's lockfile carries ctutils 0.4.2, so security-audit was red for every PR. #641 bumps it to 0.4.4. Once that lands, update this branch and the check should go green.
I reviewed 401c7c27 and ran the test against four edits of the workflow:
pristine rc=0 Scheduled cargo audit schedule contract passed.
schedule block removed rc=1 FAIL: scheduled cargo audit has no schedule trigger
run: cargo audit --ignore RUSTSEC-2026-0385 rc=1 FAIL: workflow must run plain cargo audit exactly once
permissions: contents: write rc=1 FAIL: cargo audit workflow must have read-only permissions
checkout SHA bumped in cargo-audit.yml AND ci.yml rc=1 FAIL: cargo audit actions must match the approved CI pins
scripts/check_test_reachability.sh passes.
One change before merge. The last line above shows the problem. Dependabot groups all action bumps into one PR (.github/dependabot.yml, github-actions group), and that PR rewrites the pins in both workflows at once. expected_actions holds the two SHAs as literals, so the first grouped bump turns docs-and-hygiene red, and someone then has to edit a test to accept a routine update. Read the expected pins from the security-audit job in ci.yml instead:
ci = yaml.safe_load(Path(".github/workflows/ci.yml").read_text(encoding="utf-8"))
expected_actions = [s["uses"] for s in ci["jobs"]["security-audit"]["steps"] if "uses" in s]That keeps the property the issue asked for (same pins as CI) and survives the bump. Please keep the full-SHA regex check as it is. If you also assert len(expected_actions) == 2, a renamed job fails loudly and can't pass by comparing two empty lists.
Optional: timeout-minutes: 15 on the job. #629 adds timeouts everywhere, so this is fine to leave for that PR.
|
Thanks for the feedback, Vladimir. I've made the change you suggested. The test now gets the action pins from the I've also kept the full SHA check and added the check for exactly two actions. I've run the tests locally and everything passed, including the test reachability check and I've pushed the update in commit |
vladimirrott
left a comment
There was a problem hiding this comment.
Thanks, @Humerous. You took the suggestion and hardened it past what I asked: the test now checks the action names in security-audit, finds the install step by its uses instead of by position, and rejects non-mapping steps before indexing them.
I reviewed 131f8001 and ran the test against ten versions of the two workflows:
pristine rc=0 Scheduled cargo audit schedule contract passed.
checkout SHA bumped in cargo-audit.yml AND ci.yml rc=0 Scheduled cargo audit schedule contract passed.
checkout SHA bumped in cargo-audit.yml only rc=1 FAIL: cargo audit actions must match the approved CI pins
checkout SHA bumped in ci.yml only rc=1 FAIL: cargo audit actions must match the approved CI pins
both pinned to tag @v7 rc=1 FAIL: action is not pinned to a full SHA: actions/checkout@v7
security-audit job renamed in ci.yml rc=1 FAIL: security-audit must contain exactly two actions
schedule block removed rc=1 FAIL: scheduled cargo audit has no schedule trigger
run: cargo audit --ignore RUSTSEC-2026-0385 rc=1 FAIL: workflow must run plain cargo audit exactly once
permissions: contents: write rc=1 FAIL: cargo audit workflow must have read-only permissions
tool: cargo-deny rc=1 FAIL: install action must install cargo-audit
The second line is the one that matters: a grouped Dependabot bump now passes, and drift in either file alone still fails. The pristine and grouped-bump cases also pass on the tree merged with current main. shellcheck 0.10.0 is clean on the test, and all 14 checks on the board are green.
I approve it. The new workflow has schedule and workflow_dispatch triggers only, contents: read, both actions SHA-pinned, and no secrets. Because it adds a workflow file, I'll merge it by hand after updating the branch, which is five commits behind main and merges clean. Nothing else is needed from you.
If you want another CI one, #631 fits what you just did: release.yml publishes to npm and crates.io in parallel, so one registry can ship a version the other refused. I'll hold it for you if you want it.
Minor release. #627 keys request_hash with an HMAC under the audit key (chain_version 4; previews stored by an older release fail closed after upgrading) and #639 changes the history request a newer CLI sends, so a caller relying on the old behaviour notices: the middle digit moves. Also: the planner sees only its host's distribution (#626, #656, #658, #684), checkpoint and the MCP audit tools share the audit-store resolver (#636), every workflow job has a time limit (#662), a weekly cargo audit (#640), release hardening (#635, #637, #660), and every published figure is rendered from its source (#685). Claude-Session: https://claude.ai/code/session_01UpyrhbDTW1gBwzGAC44GYU Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Closes #622.
workflow_dispatchsupport.security-auditPR check unchanged.Validation
bash tests/release/cargo-audit-schedule.test.sh— passedbash scripts/check_test_reachability.sh— passedgit diff --check— passedThe new scheduled workflow runs plain
cargo auditwithout advisory ignores.