Skip to content

ci: GHA workflow security cleanup#288

Open
emptyhammond wants to merge 3 commits into
mainfrom
worktree-fixup-workflows
Open

ci: GHA workflow security cleanup#288
emptyhammond wants to merge 3 commits into
mainfrom
worktree-fixup-workflows

Conversation

@emptyhammond
Copy link
Copy Markdown

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:

  • Disable credential persistence on actions/checkout steps so the default GITHUB_TOKEN is not left in the local git config after checkout.
  • Scope permissions explicitly: top-level permissions: {} on both workflows, with each job granted only the GITHUB_TOKEN scopes it actually needs (contents: read for the build/test
    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).
  • Pin all third-party actions to commit SHAs (with the tag preserved as a comment) so an upstream tag move can't silently change what runs in CI.

No behavioural changes intended — the workflows run the same checks against the same inputs.

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.
@emptyhammond emptyhammond requested a review from zknill May 27, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant