Repository navigation
ci: keep write tokens away from third-party code - #123
Merged
Merged
Conversation
Pin each third-party action that runs with a write token to the commit its major tag points to today: peter-evans/create-pull-request, iarekylew00t/verified-bot-commit, softprops/action-gh-release, googleapis/release-please-action and crazy-max/ghaction-import-gpg, wherever this repository uses them. A major tag can be moved to any commit, and these actions write to the repository or handle the release signing key. Every other action still floats on its major. Dependabot updates the commit and its version comment, and its cooldown applies to these updates as to any other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split changelog-autoupdate.yml into two jobs. `generate` installs git-cliff and markdownlint, regenerates CHANGELOG.md under a read-only token with no persisted credentials, and uploads the file. The `pull-request` job, which holds contents and pull-requests write, runs only checkout, download-artifact and create-pull-request, pinned to a commit. The id-token grant goes, since no step requests an OIDC token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #123 +/- ##
=======================================
Coverage 50.23% 50.23%
=======================================
Files 33 33
Lines 2598 2598
=======================================
Hits 1305 1305
Misses 1293 1293
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The `# vX.Y.Z` after each pinned commit stays; Dependabot reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 workflows let third-party code run beside a write token.
changelog-autoupdate.ymlinstalled git-cliff and markdownlint in the job that opens the pull request, and the actions that write to the repository floated on major tags. This moves the changelog build to a read-only job and pins each action that holds a write token to a commit.Changes
changelog-autoupdate.yml: one job becomes two.generateinstalls git-cliff and markdownlint and rebuildsCHANGELOG.mdunder a read-only token, with no credentials persisted by checkout, then uploads the file.pull-requestholds contents and pull-requests write and runs only checkout, download-artifact and create-pull-request. Theid-token: writegrant goes, since no step requests an OIDC token.crazy-max/ghaction-import-gpginrelease-publish.ymlandrelease-tag.yml, pinned to2dc316d(v7.0.0). It imports the release signing key in jobs that hold contents write.peter-evans/create-pull-requestinrelease-pr.ymlandchangelog-autoupdate.yml, pinned to5f6978f(v8.1.1).iarekylew00t/verified-bot-commitinpre-commit-autoupdate.yml, pinned to1ee4374(v2.3.6).A major tag such as
@v8can be moved to any commit, and the next run executes whatever it points to with that token. Every other action still floats on its major, so this adds no Dependabot pull requests for actions that cannot write. Dependabot updates each pinned commit and its# vX.Y.Zcomment like any other version, under the same schedule and 30-day cooldown.Testing
changelog-autoupdate.ymldispatched on this branch, run 40627499767: both jobs passed, and docs(CHANGELOG.md): autoupdate Unreleased section #101 got a GitHub-verified commit by github-actions that touches onlyCHANGELOG.md. A second run frommain(40627570427) then reset docs(CHANGELOG.md): autoupdate Unreleased section #101, so it lists no commits from this branch.🤖 Generated with Claude Code