security: SHA-pin all Actions + least-privilege workflow permissions (PER-8604, PER-8608)#2278
Open
Shivanshu-07 wants to merge 1 commit into
Open
security: SHA-pin all Actions + least-privilege workflow permissions (PER-8604, PER-8608)#2278Shivanshu-07 wants to merge 1 commit into
Shivanshu-07 wants to merge 1 commit into
Conversation
…s (PER-8604, PER-8608) PER-8608 (CWE-829) — every third-party action across all 11 workflows was pinned to a mutable tag, allowing a hijacked/retagged action to inject code into CI (which handles signing keys and publish tokens). Pin every `uses:` to an immutable 40-char commit SHA (tag preserved in a trailing comment): checkout, setup-node, cache, upload-artifact, download-artifact, stale, github-script, action-regex-match, pull-request-comment-branch, gha-jobid-action, winterjung/split, trigger-workflow-and-wait, create-pull-request. PER-8604 (CWE-732) — workflows ran with the implicit write-all GITHUB_TOKEN. Add a top-level `permissions: contents: read` to every workflow and minimal job-level grants only where required: - executable.yml (build, notify): contents: write — upload release assets - stale.yml: issues: write, pull-requests: write - sdk-regression.yml: statuses: write + pull-requests: read Also re PER-8610: sdk-regression.yml is issue_comment-triggered but already gates execution on an author-permission check (write/admin collaborators only); the least-privilege block above further limits the token exposed to that flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
First of several focused percy-cli security PRs. Covers the two High-severity CI/CD hardening findings (deadline 2026-06-16) and tightens the surface for PER-8610.
permissionsblock (write-allGITHUB_TOKEN)Changes
PER-8608 — SHA-pin everything: every
uses:across all 11 workflows is now pinned to an immutable 40-char commit SHA (version tag preserved in a trailing comment). Pinned actions:checkout,setup-node,cache,upload-artifact,download-artifact,stale,github-script,action-regex-match,pull-request-comment-branch,gha-jobid-action,winterjung/split,trigger-workflow-and-wait,create-pull-request. (softprops/action-gh-releaseand the Semgrep checkout/codeql were already pinned.)PER-8604 — least privilege: top-level
permissions: contents: readon every workflow, with minimal job-level grants only where needed:executable.yml(build,notify) →contents: write(upload release assets)stale.yml→issues: write,pull-requests: writesdk-regression.yml→statuses: write+pull-requests: readRe PER-8610 (issue_comment exposes token):
sdk-regression.ymlalready gates execution on an author-permission check (onlywrite/admincollaborators), so the trigger isn't open to arbitrary commenters; the least-privilege block here further limits what that flow's token can do.Verification
uses:; every workflow declarespermissions:.stalev6→v9 to a maintained release).Closes PER-8604, PER-8608. Hardens PER-8610.
🤖 Generated with Claude Code