ci(security): add a least-privilege permissions block to sync-check#32
Merged
Conversation
sync-check.yml declared no `permissions:`, so it inherited the repository's default GITHUB_TOKEN scope -- read/write across contents, issues, and packages on older repo settings. All three of its jobs only check out the repo and run npm; none writes a comment, a commit, or a release. release.yml already scopes itself to `contents: write` because it genuinely creates a Release. sync-check needs strictly less: `contents: read`. Worth naming: this repo ships an infra-config-reviewer agent whose stated job is flagging "over-broad permissions" in CI/CD workflow config, and a supply-chain-security skill. A missing permissions block is the first thing either would report about this workflow.
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.
Why
sync-check.ymldeclared nopermissions:, so it inherited the repository's defaultGITHUB_TOKENscope — read/write across contents, issues, and packages on older repo settings.All three of its jobs (
sync-determinism,frontmatter-lint,tests) only check out the repo and run npm. None writes a comment, a commit, or a release.release.ymlalready scopes itself tocontents: writebecause it genuinely creates a Release —sync-checkneeds strictly less.The part that stings
This repo ships:
infra-config-revieweragent — "Reviews infrastructure-as-code and deploy config for misconfiguration — over-broad permissions, public exposure, root containers, unpinned images, plaintext secrets."supply-chain-securityskill.A missing
permissions:block on a CI workflow is the first thing either would report. It is also the first thing a reviewer greps for on a public repo.Verification
This PR's own CI run is the proof the scope is sufficient — it executes under the new block.