security: harden sdk-regression issue_comment workflow — pin actions, scope permissions + token (PER-8610)#2332
Open
Shivanshu-07 wants to merge 1 commit into
Open
Conversation
… (PER-8610) F-012 (CWE-284/CWE-269): the issue_comment-triggered SDK Regression workflow injects the cross-repo WORKFLOW_DISPATCH_ACTIONS_TOKEN PAT into steps that do not need it, including a third-party action. Scope the PAT to only the single step that strictly requires cross-repo dispatch: - Tiryoh/gha-jobid-action (third-party) now uses the built-in GITHUB_TOKEN with a new job-level `actions: read` grant (it only reads this run's job metadata on percy/cli). - Both actions/github-script commit-status steps now use GITHUB_TOKEN, covered by the existing job-level `statuses: write`. - convictional/trigger-workflow-and-wait keeps the PAT — it is the only step that dispatches test.yml in another percy repo, which GITHUB_TOKEN cannot do. All third-party action SHA pins were re-resolved live against the GitHub API and confirmed correct (unchanged). issue_comment trigger, the author-permission (write/admin) guard, and the regression flow are unchanged. Co-Authored-By: Claude Opus 4.8 <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
Hardens
.github/workflows/sdk-regression.yml(F-012, CWE-284/CWE-269). Thisissue_comment-triggered workflow injects the cross-repo dispatch PATWORKFLOW_DISPATCH_ACTIONS_TOKENinto more steps than strictly need it — including a third-party action — so a step compromise could exfiltrate a token that can dispatch workflows across otherpercy/*repos.The
issue_commenttrigger intent, the author-permission guard (write/admin collaborators only), and the regression-trigger flow are all unchanged.Actions SHA-pinned (verified)
All third-party action
uses:are pinned to full 40-char commit SHAs with a trailing# vX.Y.Zcomment. Each tag was re-resolved live against the GitHub API for this PR and confirmed correct (already pinned by an earlier hardening pass; no SHA changed):actions/github-scriptf891eff65186019cbb3f7190c4590bc0a1b76fbcxt0rted/pull-request-comment-branche8b8daa837e8ea7331c0003c9c316a64c6d8b0b1actions-ecosystem/action-regex-match9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665bTiryoh/gha-jobid-actionbe260d8673c9211a84cdcf37794ebd654ba81eefwinterjung/split7f51d99e7cc1f147f6f99be75acf5e641930af88convictional/trigger-workflow-and-waitf69fa9eedd3c62a599220f4d5745230e237904bePermissions block
Top-level
permissions: contents: read(already present). Theregressionjob keeps its least-privilege grant and addsactions: readso the built-inGITHUB_TOKENcan read this run's job metadata:How the token injection was narrowed
WORKFLOW_DISPATCH_ACTIONS_TOKENis now injected into exactly one step — the only one that strictly requires it:convictional/trigger-workflow-and-wait— keeps the PAT. It dispatchestest.ymlin a differentpercy/*repo, which the built-inGITHUB_TOKENcannot do.Tiryoh/gha-jobid-action(third-party) — switched to${{ github.token }}. It only reads this run's job metadata onpercy/cli; the newactions: readgrant covers it. The cross-repo PAT is no longer handed to a third-party action.actions/github-scriptcommit-status steps — switched to${{ github.token }}. They only write commit statuses onpercy/cli, covered by the existing job-levelstatuses: write.No workflow/job-level
envexposed the token; the over-exposure was per-stepwith:inputs, which is what this PR narrows.🤖 Generated with Claude Code