Skip to content

ci: GHA workflow security cleanup#36

Merged
emptyhammond merged 4 commits into
mainfrom
worktree-fixup-workflows
May 28, 2026
Merged

ci: GHA workflow security cleanup#36
emptyhammond merged 4 commits into
mainfrom
worktree-fixup-workflows

Conversation

@emptyhammond

Copy link
Copy Markdown
Contributor

Routine hygiene pass over the GitHub Actions workflows in this repo, addressing findings from a workflow security audit. Changes are split into four commits, one per finding type:

  • Disable credential persistence on actions/checkout so the default GITHUB_TOKEN is not left in the local git config after checkout.
  • Scope workflow and job permissions explicitly: top-level permissions: {} on each workflow, with each job granted only the GITHUB_TOKEN scopes it actually needs (contents: read for the
    check job; contents: read plus the deployments: write / id-token: write that the called reusable workflow declares it needs).
  • Replace secrets: inherit in the Features workflow with an explicit pass-through of just ABLY_AWS_ACCOUNT_ID_SDK — the only secret the called reusable workflow declares as required —
    so unrelated secrets are not forwarded.
  • Pin all third-party actions and the reusable workflow reference to full commit SHAs (with the original @v1 / @v2 / @main ref preserved as a trailing comment) so an upstream tag or
    branch move can't silently change what runs in CI.

Set persist-credentials: false on actions/checkout so the default
GITHUB_TOKEN is not left in the local git config after the checkout
step completes.
Add a top-level permissions: {} block to each workflow so no
GITHUB_TOKEN scopes are granted by default, then grant each job only
the scopes it actually needs:

  - check.yml's check job: contents: read for checkout
  - features.yml's build job: contents: read for checkout, plus
    deployments: write and id-token: write to match what the called
    reusable workflow declares it needs
Replace secrets: inherit, which forwards every secret available to the
calling workflow, with an explicit pass-through of just
ABLY_AWS_ACCOUNT_ID_SDK — the only secret the called workflow
declares as required.
Replace floating tag references (@v1, @v2, @main) on third-party
actions and reusable workflows with full commit SHAs, keeping the
original ref as a trailing comment for readability. Pinning to a
commit ensures an upstream tag or branch move cannot silently change
what runs in CI.
@emptyhammond
emptyhammond merged commit 4531b6a into main May 28, 2026
1 of 2 checks passed
@emptyhammond
emptyhammond deleted the worktree-fixup-workflows branch May 28, 2026 10:17
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.

2 participants