ci(workflows): pin actions to hashes and restrict token permissions - #153
Merged
Conversation
zizmor reports 8 high and 6 medium findings on the three workflows:
- unpinned-uses / ref-confusion: every action is referenced by a mutable tag,
so pin them to commit hashes with the version kept as a trailing comment.
- excessive-permissions: no workflow declares a permissions block, so the jobs
fall back to the default token scope. Declare `permissions: {}` at the
workflow level and keep only what each job actually needs.
- artipacked: actions/checkout persists the token in .git/config by default,
and none of these workflows push through it, so set persist-credentials to
false. The gh-pages deploy authenticates with its own github_token input.
`zizmor .github/workflows/` now reports no findings.
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.
Related Issues
Description
zizmorreports 8 high and 6 medium findings on the three workflows. This PRclears all of them.
unpinned-uses/ref-confusion- every action is referenced by a mutabletag. Pin them to commit hashes, keeping the version as a trailing comment:
Each one is the latest release of the major version already in use, so no
behaviour changes.
excessive-permissions- no workflow declares apermissionsblock, so thejobs fall back to the default token scope. Declare
permissions: {}at theworkflow level and keep only what each job actually needs:
issues: writeforassign-issue,
contents: writefor deploy,contents: readfor code-analysis.artipacked-actions/checkoutpersists the token in.git/configbydefault. None of these workflows push through it, so set
persist-credentials: false. The gh-pages deploy authenticates with its owngithub_tokeninput and is unaffected.Verification
Locally with zizmor v1.29.0:
--persona=pedanticalso reports 0 high and 0 medium. The remaininginformational and low findings there (
concurrency-limits,undocumented-permissions) are pedantic-only audits and are left alone.