Repository navigation
fix(workflows): drop vestigial job-level GITHUB_TOKEN write grants - #1137
Merged
Merged
Conversation
Every job-level contents:write / actions:write grant in the rendered release and sync workflow templates is written to by a COMMIT_APP or RELEASE_APP installation token, never the job's GITHUB_TOKEN. Reduce those grants to read across prepare-release, promote-release, release, release-core, release-publish, sync-issues and sync-main-to-dev, shrinking the blast radius of a compromised step to a read-only GITHUB_TOKEN. Point promote-release validate's draft-release check at the RELEASE_APP token (GitHub only returns drafts to a push-capable token) so the job can drop to contents:read. Keep sync-issues sync's actions:write — its cache deletion calls gh api -X DELETE on github.token. Refs: #1136
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.
Closes #1136
What
An OpenSSF Scorecard TokenPermissions audit (on
vig-os/commit-action) traced every job-levelcontents: write/actions: writegrant in the rendered release/sync workflow templates to the token that actually performs the write. Every git push, tag push,gh release,gh pr,gh apimutation andgh workflow runrides a COMMIT_APP / RELEASE_APP installation token, not the job'sGITHUB_TOKEN— so those grants are vestigial. This reduces them toreadat the source (assets/workspace/.github/workflows/), propagating to all consumers on upgrade.Reductions (write → read on
GITHUB_TOKEN)Caller/callee pairs (
release.ymlcore/publish↔release-core.yml/release-publish.yml) are lowered on both sides in the same change.Two grants handled with care
promote-release.ymlvalidate— its Verify draft GitHub Release exists step listed releases withGH_TOKEN: github.tokenand matched a draft; GitHub only returns drafts to a push-capable token, so a bare read-only token would hide the draft and fail every promotion. The step now uses the RELEASE_APP token the job already mints, so the job can safely drop tocontents: read.sync-issues.ymlsyncactions: write— kept. Its Delete old cache step callsgh api .../actions/caches/{id} -X DELETEongithub.token.Optional same-justification extras (
pull-requests/issueswrite on App-token-driven jobs, not Scorecard-flagged) are deliberately left in place — out of scope here.Verification
tests/bats/just.batsto pin the release caller/calleeGITHUB_TOKENblocks read-only (RED → GREEN).bats tests/bats/just.bats— 46/46 pass.pytestontest_promote_mergeability,test_floating_tags,test_release_tag_prefix,test_workflow_prepare_extension— 30/30 pass.just precommit(incl. actionlint, yamllint, sync-manifest) green.vig-os/commit-action#94/#95moved the repo-local smoke workflows topermissions: {}+ job-level write with E2E and published-tag smokes passing.Pre-merge validation
The
devcontainer-smoke-testrepository_dispatchflow already renders these templates into a real target and drives the full pipeline against them with realRELEASE_APP/COMMIT_APPtokens, so the App-token writes are genuinely exercised (a broken reduction fails the write and errors the wait step):release-corefinalize→ sync-issues (finalize triggers it and waits, so a brokensync-issuespermission fails the release the dispatch is waiting on)merge→ push tomain→ sync-main-to-devCaveat: promote-release is gated
if release_kind == 'final'. An RC-only dispatch covers prepare + release + release-core + release-publish + sync-issues, but not promote-release or (transitively) sync-main-to-dev. To give the promote-release changes — including the load-bearingvalidateVerify draft GitHub Release existsGH_TOKENfix — live coverage, validate with a final dispatch, not just a candidate.Refs: #1136