Repository navigation
ci: declare least-privilege permissions and cancel superseded runs - #7
Merged
Merged
Conversation
aeddi
marked this pull request as ready for review
November 3, 2026 21:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two workflow changes.
Least-privilege permissions.
ci.ymlandsecurity_audit.ymldeclare their tokenpermissions instead of inheriting the repository default. Every CI job gets
contents: read. The audit job also getschecks: write, granted on the job rather than theworkflow, so a job added later starts with no write of its own.
This repository's default token was already read-only, so the only privilege dropped today
is
Packages: read. The value is durability: a change to the repository default can nolonger silently widen what these workflows may do.
Cancel superseded pull request runs. A new push to a PR branch cancels the run already in
flight for it. Every other run gets a concurrency group of its own, keyed on the run id: a
shared group would make GitHub cancel a run that is still queued when the next push
arrives, which could leave a commit on
mainwith no CI result at all.What changes for the security audit
With
checks: write, the audit action publishes its findings as a check run on pullrequests and pushes that touch
Cargo.lock, instead of failing with a 403. The formattedadvisory list moves from the job log into that check run. The job itself stays red while
live advisories exist — the action still fails on critical findings — so such a PR shows
the existing red job plus a red "Security audit" check.
The nightly run takes the other path and files an issue, which needs
issues: write. That isnot granted, and this repository has issues disabled, so a scheduled run reports through its
log alone.
Verification
actionlintclean on all three workflows.zizmor: 8excessive-permissionsfindings before, 0 after, at both the default and thepedantic persona, with nothing else introduced.
permission:andcancel-in-progres:are rejected by actionlint;contents: writepasses actionlint and iscaught by zizmor. The tools are complementary, not redundant.
regressions of that line pass both silently. It rests on GitHub's documented behaviour, a
queued run in the same group is cancelled whatever
cancel-in-progresssays, and on fourreal pushes to
main24 seconds apart: all four completed under the base, and two wouldhave been cancelled while queued under a shared group.