Repository navigation
Pin workflow actions to commits and grant their tokens only what they need - #3088
Merged
Merged
Conversation
… need Every action and reusable workflow was referenced by a tag or a branch its owner can move, and every job ran with the repository's default read/write token. Both Danger callers also passed `secrets: inherit`, handing every repository secret to another repository's workflow, though Danger uses only the token. Each reference now names the commit its tag or branch points to today, with the version as a comment, so what runs is unchanged. test and edge read only. The Danger callers grant what the called workflows ask for, and no secrets. Dependabot keeps the pins current, proposing a release once it is a week old. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ericproulx
force-pushed
the
chore/pin-workflows-read-only-tokens
branch
from
November 20, 2026 23:10
c34bf16 to
a38aa1d
Compare
Danger ReportNo issues found. |
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
While reviewing #3077 and #3078 I asked for their reusable workflows to be pinned by SHA, but none of our own workflows were. All 12 action and reusable-workflow references used a tag or branch their owner can move. Every job also ran with the repository's default token, which is read/write, since no workflow declared
permissions:.Pins
Each reference now names the commit its tag or branch points to today, with the version as a comment, so nothing that runs changes:
actions/checkout@v6d23441a4… # v6.1.0ruby/setup-ruby@v1(a branch)be3c7df2… # v1.343.0coverallsapp/github-action@v28d6379e1… # v2.3.8numbata/danger-pr-commentdanger-run.yml@v0.2.06152b443… # v0.2.0numbata/danger-pr-commentdanger-comment.yml@v0.1.034fd3761… # v0.1.0Tokens and secrets
test.ymlandedge.ymldeclarepermissions: contents: read. Coveralls only needs the token to identify the repository: it posts no status or comment on master or on PRs.secrets: inherit. It handed every repository secret to the called workflow, though Danger's workflows only usesecrets.GITHUB_TOKEN || github.token. Each caller now grants exactly what its called workflow declares:contents: readfor the run, andcontents: read,actions: read,issues: write,pull-requests: writefor the comment.Dependabot
.github/dependabot.ymlupdates the pinned actions and reusable workflows weekly, grouped into one PR, with their version comments.cooldown: default-days: 7means a release is proposed only once it's a week old, so a compromised one has time to be caught.Validation
test.ymlanddanger.ymlrun on this PR with these changes.Danger Commentruns onworkflow_runfrom master's copy, so its new caller only takes effect after merge.🤖 Generated with Claude Code