Skip to content

AST-171789 Use GITHUB_TOKEN instead of PAT in pr-automation workflow - #726

Closed
cx-lior-poterman wants to merge 1 commit into
mainfrom
ast-171789-pr-automation-use-github-token
Closed

cx-lior-poterman wants to merge 1 commit into
mainfrom
ast-171789-pr-automation-use-github-token

Conversation

@cx-lior-poterman

Copy link
Copy Markdown
Contributor

pr-automation.yml runs on pull_request_target, which any external contributor can trigger by opening a PR against this public repo, bypassing the fork-approval gate and running with base-repo secrets. The job only needs gh pr edit --add-reviewer, already covered by the existing pull-requests: write permission, so it did not need the long-lived org PAT it was using. Swapping to the ephemeral GITHUB_TOKEN cuts that exposure and also makes the workflow's contents: none ceiling actually binding, since a PAT carries its own scopes regardless of the permissions block.

pr-automation.yml runs on pull_request_target, which executes with base-repo
secrets and is reachable by any external contributor opening a PR against this
public repo, without the fork-approval gate that guards plain pull_request
runs. The job only calls `gh pr edit --add-reviewer`, already covered by the
workflow's `pull-requests: write` permission, so the long-lived org PAT it was
using is unnecessary exposure. Swap it for the ephemeral GITHUB_TOKEN, which
also makes the workflow's `contents: none` ceiling actually binding since a PAT
carries its own scopes regardless of the permissions block.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cx-lior-poterman
cx-lior-poterman requested a review from a team August 30, 2026 13:23
@stepsecurity-app

stepsecurity-app Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

✅ Resolved — a later workflow run passed this policy check.

Original alert (resolved)

Security Policy Alert: Secret Policy Violation

This workflow run has been blocked by StepSecurity's secrets policy because it accesses secrets and the workflow file differs from the default branch.

Secret references detected:

  • secrets.GITHUB_TOKEN at line 19

To approve this workflow, please add the workflows-approved label to this PR.

Note: The label must be added by someone other than the PR author (cx-lior-poterman) or automation bots to ensure proper security review.

After the label is added, you can re-run the blocked workflow to proceed.

This workflow will be automatically approved once merged into the default branch.

For more information, see StepSecurity's Secret Exfiltration Policy documentation.

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