Skip to content

chore(ci): scope workflow tokens and pin actions to commit SHAs - #674

Merged
aterga merged 1 commit into
mainfrom
claude/autopatch-scan-77d84e9d-vuln-5270816-r1xrzy
Oct 19, 2026
Merged

aterga merged 1 commit into
mainfrom
claude/autopatch-scan-77d84e9d-vuln-5270816-r1xrzy

Conversation

@aterga

@aterga aterga commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Hardens the CI workflows' token scope and action references.

Changes

  • Token scope: tests.yaml, validation.yaml, builds.yaml and benchmarks.yaml now declare permissions: contents: read instead of inheriting the repository default. release.yaml declares contents: write, the only scope orbit-cli release publish needs (push tags, create releases).
  • Pinned actions: every uses: in .github/, including the setup-node and setup-python composite actions, is pinned to a full commit SHA with a version comment. Each SHA is what the previous tag/branch resolved to, so the code that runs is unchanged. dfinity/setup-dfx uses the same commit already pinned in .github/actions/deploy-backend.
  • Checkout credentials: persist-credentials: false on every checkout that does not push. release.yaml keeps credentials explicitly because it runs git push origin --tags.

Notes

  • No scripts run by these jobs make authenticated git or gh calls; artifacts and caches use the runtime token, which permissions: does not affect.
  • Recommended alongside this: set the repository's default workflow token permission to read-only.

Generated by Claude Code

Workflows without a `permissions:` block inherited the repository's
default token, so test, validation, build and benchmark jobs running on
push to main or merge_group held a token that could write releases,
tags and branches, while executing third-party actions by mutable
reference (dfinity/setup-dfx@main, @vn tags).

- tests, validation, builds, benchmarks: `permissions: contents: read`
- release: `permissions: contents: write`, the only scope that
  `orbit-cli release publish` needs (push tags, create releases)
- pin every `uses:` in .github/, including the setup-node and
  setup-python composites, to a full commit SHA with a version comment
- `persist-credentials: false` on every checkout that does not push;
  release.yaml keeps it explicitly for `git push origin --tags`

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KLiTf9UsrvvHjNxzpyjV45
Copilot AI balanced review requested due to automatic review settings October 19, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

No concrete defects were identified, but the pinned commits’ provenance and equivalence to previous references remain unverified.

No open issues 🎉

What changed in this PR

Hardens CI by limiting workflow token permissions and pinning external actions to commit SHAs.

Changes:

  • Grants read-only contents access to CI and write access to releases.
  • Pins external actions in workflows and shared setup actions.
  • Disables persisted checkout credentials except for release publishing.
File Description
.github/​workflows/​validation.yaml Restricts permissions, pins actions, and disables credential persistence.
.github/​workflows/​tests.yaml Applies token, action-reference, and checkout hardening.
.github/​workflows/​release.yaml Grants release write access and retains push credentials.
.github/​workflows/​builds.yaml Hardens checkout and pins Docker setup.
.github/​workflows/​benchmarks.yaml Restricts permissions and pins benchmark dependencies.
.github/​actions/​setup-python/​action.yaml Pins Python setup.
.github/​actions/​setup-node/​action.yml Pins Node.js, pnpm, and cache actions.

Review effort: Balanced

@aterga
aterga marked this pull request as ready for review October 19, 2026 16:44
@aterga
aterga requested a review from a team as a code owner October 19, 2026 16:44
@aterga
aterga enabled auto-merge (squash) October 19, 2026 16:44
@zeropath-ai

zeropath-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to 603c252.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► .github/actions/setup-node/action.yml
      Modify action references to specific commit hashes (v4 equivalents) for setup-node
► .github/actions/setup-python/action.yaml
      Update Python setup step to a specific commit hash (v4 equivalent)
Enhancement ► .github/workflows/benchmarks.yaml
      Add permissions: contents: read block; adjust checkout and sccache-action references to specific commits; adjust sccache step references
► .github/workflows/builds.yaml
      Add permissions: contents: read; update checkout and docker setup steps to specific commits
► .github/workflows/release.yaml
      Update checkout step to specific commit; add permissions: contents: write; adjust related comments
► .github/workflows/tests.yaml
      Add permissions: contents: read; update checkout and sccache-action references to specific commits
► .github/workflows/validation.yaml
      Update checkout steps to specific commits; add permissions: contents: read; update dfx/setup-dfx reference to specific commit

@aterga aterga changed the title ci: scope workflow tokens and pin actions to commit SHAs chore(ci): scope workflow tokens and pin actions to commit SHAs Oct 19, 2026
@aterga
aterga merged commit c766e61 into main Oct 19, 2026
53 of 54 checks passed
@aterga
aterga deleted the claude/autopatch-scan-77d84e9d-vuln-5270816-r1xrzy branch October 19, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants