Skip to content

ci: add scheduled Cargo audit workflow (#622) - #640

Merged
vladimirrott merged 3 commits into
lacs-project:mainfrom
Humerous:fix/622-scheduled-cargo-audit
Oct 25, 2026
Merged

vladimirrott merged 3 commits into
lacs-project:mainfrom
Humerous:fix/622-scheduled-cargo-audit

Conversation

@Humerous

Copy link
Copy Markdown
Contributor

Summary

Closes #622.

  • Add a dedicated Cargo audit workflow running daily at 06:17 UTC, with manual workflow_dispatch support.
  • Use read-only permissions and the same SHA-pinned checkout and cargo-audit installation actions as the existing CI workflow.
  • Preserve the existing required security-audit PR check unchanged.
  • Add a regression test for the scheduled workflow and register it in CI.

Validation

  • bash tests/release/cargo-audit-schedule.test.sh — passed
  • bash scripts/check_test_reachability.sh — passed
  • git diff --check — passed

The new scheduled workflow runs plain cargo audit without advisory ignores.

@Humerous

Copy link
Copy Markdown
Contributor Author

The required security-audit check is failing on RUSTSEC-2026-0385 (cutils 0.4.2; recommended upgrade to 0.4.4 or later).

This PR does not modify Cargo.lock or the existing security-audit job. The last successful CI run on main (October 21) scanned the same 656 dependencies without reporting this advisory.

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 vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@Humerous

Humerous commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, Vladimir.

I've made the change you suggested. The test now gets the action pins from the security-audit job in ci.yml, instead of having them hardcoded.

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 git diff --check.

I've pushed the update in commit 131f800. Let me know if there's anything else you'd like me to check.

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@vladimirrott
vladimirrott merged commit abfff84 into lacs-project:main Oct 25, 2026
13 checks passed
@vladimirrott

Copy link
Copy Markdown
Member

Merged as abfff841. Thank you, @Humerous. main now gets a cargo audit at 06:17 UTC every day, including the days nobody pushes, which is the gap #622 described. Deriving the pins from ci.yml means a grouped Dependabot bump will move both jobs together. #631 is still held for you if you want it.

vladimirrott added a commit that referenced this pull request Oct 27, 2026
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]>
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.

cargo audit only runs on push, so main sat on four rustls advisories for 38 hours before anything ran

2 participants