ci: GHA workflow security cleanup#288
Open
emptyhammond wants to merge 3 commits into
Open
Conversation
Pass `persist-credentials: false` to every `actions/checkout` invocation so the default `GITHUB_TOKEN` is not left in the local git config after checkout. Affects each job in `dev-ci.yml` and the `release` job in `release.yml`. No behavioural change to the workflows.
Add a top-level permissions block (set to no scopes) to both workflows so the default GITHUB_TOKEN starts with zero scopes, and grant each job only the scopes it actually needs: - dev-ci.yml: every job now declares contents: read (required for checkout). The docs job retains id-token: write (for AWS OIDC via aws-actions/configure-aws-credentials) and deployments: write (for ably/sdk-upload-action to post deployment status). - release.yml: the release job's contents: write is reduced to contents: read. The job only checks out the repo and runs npm publish; it never writes back to the repo via GITHUB_TOKEN. No behavioural change to what the workflows actually do.
Replace floating tag references (e.g. @v2, @V3) with the resolved commit SHAs, keeping the original tag as a trailing comment so the intended version stays readable. This prevents an upstream tag move or compromise from silently changing what runs in CI. Pins applied: - actions/checkout@v2 -> ee0669bd1cc54295c223e0bb666b733df41de1c5 - actions/checkout@v3 -> f43a0e5ff2bd294095638e18286ca9a3d1956744 - actions/setup-node@v1 -> f1f314fca9dfce2769ece7d933488f076716723e - actions/setup-node@v3 -> 3235b876344d2a9aa001b8d1453c930bba69e610 - aws-actions/configure-aws-credentials@v1 -> 67fbcbb121271f7775d2e7715933280b06314838 - ably/sdk-upload-action@v1 -> 8c6179796fc7ee8fc9bb28d5223ffef005b985cc No behavioural change; the same commits are what these tags pointed to.
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.
Routine hygiene pass over the GitHub Actions workflows in this repo, addressing findings from a workflow security audit. Changes are split into three commits, one per finding type:
jobs; contents: read + id-token: write + deployments: write retained for the docs job; release job tightened from contents: write to contents: read since it only npm publishes).
No behavioural changes intended — the workflows run the same checks against the same inputs.