Skip to content

ci: pin the third-party actions that run with secrets and write access - #3775

Merged
KuSh merged 1 commit into
rtk-ai:developfrom
KuSh:ci/pin-privileged-actions
Oct 8, 2026
Merged

KuSh merged 1 commit into
rtk-ai:developfrom
KuSh:ci/pin-privileged-actions

Conversation

@KuSh

@KuSh KuSh commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

26b96ec ("fix(security): pin workflow actions to SHA") pinned pr-target-check.yml, and next-release.yml matches it. Both are pull_request_target workflows that read secrets.APP_PRIVATE_KEY and mint a write-scoped token — where a repointed tag does the most damage.

Two workflows in the same position were never covered:

workflow exposure unpinned third-party action
cd.yml contents: write, pull-requests: write, reads APP_PRIVATE_KEY googleapis/release-please-action@v4
release.yml contents: write, builds and publishes the binaries users install softprops/action-gh-release@v2, dtolnay/rust-toolchain@stable

A tag is mutable, so whoever owns the action repository can repoint it and have the new code run against that key — or against the build that produces the release artifacts.

googleapis/release-please-action  5c625bf  # v4.4.1
softprops/action-gh-release       3bb1273  # v2.6.2
dtolnay/rust-toolchain            4360b52  # stable branch, untagged

Each SHA was resolved from the ref it replaces, dereferencing annotated tags to their commit, and annotated with the version that actually points at it.

dtolnay/rust-toolchain is the exception worth noting: stable is a branch selecting the Rust toolchain, not a release, and the repository's only tag (v1) points at a different commit (6c977a6). There is no version to name, so the comment names the branch. Pinning its head preserves behaviour — that branch's action.yml defaults toolchain: stable, and the toolchain is still resolved at run time.

Deliberately not included

ci.yml stays on tags. It runs on pull_request with contents: read and no secrets, so pinning it would buy little and stop the toolchain and cache actions receiving fixes. actions/* is GitHub's own and stays on tags throughout.

@KuSh
KuSh force-pushed the ci/pin-privileged-actions branch from e658766 to 9b85b96 Compare August 30, 2026 13:06
@KuSh
KuSh force-pushed the ci/pin-privileged-actions branch 3 times, most recently from bbdb204 to 73b1983 Compare September 17, 2026 22:59

@aeppling aeppling 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.

@KuSh thanks pinning she is correct way to do this :)

lgtm

26b96ec pinned pr-target-check.yml, and next-release.yml matches it. Both are
pull_request_target workflows that read secrets.APP_PRIVATE_KEY and mint a
write-scoped token, which is where a repointed tag does the most damage. Two
workflows in the same position were never covered:

  cd.yml       contents: write, pull-requests: write, reads APP_PRIVATE_KEY,
               and calls googleapis/release-please-action on a floating tag
  release.yml  contents: write, builds and publishes the binaries users install,
               through softprops/action-gh-release and dtolnay/rust-toolchain

A tag is mutable, so whoever owns the action repository can repoint it and have
the new code run against that key, or against the build that produces the
release artifacts. A commit SHA cannot be repointed.

  googleapis/release-please-action  5c625bf  # v4.4.1
  softprops/action-gh-release       3bb1273  # v2.6.2
  dtolnay/rust-toolchain            4360b52  # stable branch, untagged
  actions/create-github-app-token   bcd2ba4  # v3.2.0

Each SHA was resolved from the ref it replaces and annotated with the version
that actually points at it. rust-toolchain is the exception: `stable` is a
branch selecting the Rust toolchain, and the repository's only tag, v1, points
at a different commit, so there is no version to name.

ci.yml is left on tags on purpose. It runs on pull_request with contents: read
and no secrets, so pinning it would buy little and stop the toolchain and cache
actions receiving fixes.

actions/* is not exempt either; the line is privilege, not who owns the
repository. 26b96ec already pins create-github-app-token and github-script,
the two that mint a write-scoped token or run script with secrets in reach,
while checkout, upload-artifact, download-artifact, setup-go and stale stay on
tags because none of them touch a credential. cd.yml and release.yml hold the
three create-github-app-token references 26b96ec did not reach, so one action,
one key and one set of scopes were split across two treatments. v3 and v3.2.0
both point at bcd2ba4 today, so this pins the code already running.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@KuSh
KuSh force-pushed the ci/pin-privileged-actions branch from 73b1983 to a7c5a2a Compare October 8, 2026 17:49
@KuSh
KuSh merged commit aa28394 into rtk-ai:develop Oct 8, 2026
12 checks passed
@KuSh
KuSh deleted the ci/pin-privileged-actions branch October 8, 2026 18:00
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Oct 8, 2026
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.

2 participants