Add explicit GITHUB_TOKEN permissions to ci.yml and audit.yml - #47
Merged
Conversation
Resolves CodeQL actions/missing-workflow-permissions alerts #1, #2, #3, #9. ci.yml (alerts #1 check, #3 test, #9 lints): all three jobs only check out the repo and run cargo check / cargo test / cargo fmt + clippy. Nothing writes back to GitHub, so a single workflow-level `contents: read` covers every job. audit.yml (alert #2): actions-rs/audit-check needs more than read. Its main.ts branches on the event name -- on `schedule` it calls reporter.reportIssues, which does client.issues.create (needs `issues: write`); on every other event (`push`, `pull_request` here) it calls reporter.reportCheck, which creates and updates a check run (needs `checks: write`). `contents: read` covers actions/checkout and cargo generate-lockfile. Scoped at the job rather than the workflow so a future job added to this file does not inherit the write scopes. release.yml already declares its own permissions and is not flagged; codeql.yml is already correct. Both left untouched.
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.
Resolves CodeQL actions/missing-workflow-permissions alerts #1, #2, #3, #9.
ci.yml (alerts #1 check, #3 test, #9 lints): all three jobs only check out
the repo and run cargo check / cargo test / cargo fmt + clippy. Nothing
writes back to GitHub, so a single workflow-level
contents: readcoversevery job.
audit.yml (alert #2): actions-rs/audit-check needs more than read. Its
main.ts branches on the event name -- on
scheduleit callsreporter.reportIssues, which does client.issues.create (needs
issues: write); on every other event (push,pull_requesthere) itcalls reporter.reportCheck, which creates and updates a check run (needs
checks: write).contents: readcovers actions/checkout andcargo generate-lockfile. Scoped at the job rather than the workflow so a
future job added to this file does not inherit the write scopes.
release.yml already declares its own permissions and is not flagged;
codeql.yml is already correct. Both left untouched.
Alerts resolved
actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:42actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:31actions/missing-workflow-permissions(medium) —.github/workflows/audit.yml:14actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:22Verification
permissions:block (cross-checked by parsing the YAML against the alert list).actionlintoutput is byte-identical tomain— no new findings introduced.codeql.ymluntouched.