CI: harden the workflows, add dependabot - #55
Merged
Merged
Conversation
zizmor (auditor persona) findings on .github/workflows/: - unpinned-uses: pin actions/checkout and actions/setup-python to their full commit hash, with the version as a comment - same pins borg uses. A moved tag can not silently change what runs in CI anymore. - excessive-permissions: give the CI workflow "permissions: contents: read" instead of whatever the repository default is. - artipacked: "persist-credentials: false" for the checkouts, so the GITHUB_TOKEN does not end up in .git/config for the rest of the job. Neither workflow pushes; the release workflow passes github.token to gh explicitly. - concurrency-limits: superseded CI runs of a PR are cancelled now. The release workflow gets a concurrency group that never cancels - it queues a second push of the same tag instead. - anonymous-definition: name the CI job. Pinning to hashes needs something to move the pins, so add a dependabot config modelled on borg's: grouped weekly updates for the actions and for requirements.d, with the same cooldown so brand new releases are not picked up immediately.
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.
Everything here comes from running zizmor 1.30.0 with
--persona=auditorover.github/workflows/. Nothing dangerous was found - no script injection, nopull_request_target, no secrets exposure - so this is all hardening.What zizmor complained about
unpinned-usesactions/checkoutandactions/setup-pythonare pinned to their full commit hash (# vX.Y.Zcomment kept), the same pins borg uses. A moved tag can no longer silently change what runs in CI. This also bumps them v4 -> v7.0.1 and v5 -> v7.0.0.excessive-permissionspermissions: contents: readfor the CI workflow, instead of whatever the repository default happens to be.artipackedpersist-credentials: falseon the checkouts, so theGITHUB_TOKENis not left in.git/configfor the rest of the job. Neither workflow pushes; the release workflow passesgithub.tokentoghexplicitly.concurrency-limitsanonymous-definitionname:now.zizmor --persona=auditoris clean on both workflows after this.Dependabot
Hash pins need something to move them, so
.github/dependabot.ymlis modelled on borg's: grouped weekly updates for the actions and forrequirements.d, with the same cooldown (14/30/90 days) so a brand new release is not picked up the day it appears. The CIpathsfilter already matches**.ymlandrequirements.d/*, so its PRs run CI.Note that both dependabot ecosystems only start working once dependabot is enabled for the repository in its settings.