Skip to content

security(ci): fix pull_request_target privilege escalation#44

Merged
discreteds merged 1 commit into
developfrom
hotfix/ci-security-pull-request-target
May 7, 2026
Merged

security(ci): fix pull_request_target privilege escalation#44
discreteds merged 1 commit into
developfrom
hotfix/ci-security-pull-request-target

Conversation

@discreteds

Copy link
Copy Markdown
Member

Summary

  • Severity: High — fork PRs could exfiltrate repo secrets including CLONE_PRIVATE_REPOS_TOKEN
  • Three PR workflows used pull_request_target + GITHUB_HEAD_REF checkout
  • Switched to pull_request trigger, removed secret usage, added explicit permissions

Test plan

  • Verify pytest/ruff/radon workflows trigger on PRs
  • Verify Codecov tokenless upload works
  • Verify build-and-release workflow still works on merge

🤖 Generated with Claude Code

…flows

Three workflows (pytest, ruff, radon) used pull_request_target and checked out
GITHUB_HEAD_REF, running attacker-controlled code from fork PRs with access to
repo secrets including CLONE_PRIVATE_REPOS_TOKEN.

- Switch to pull_request trigger (fork PRs run in fork context)
- Remove GITHUB_HEAD_REF checkout and dependency checkout with CLONE_PRIVATE_REPOS_TOKEN
- Add explicit permissions: contents: read
- Remove CODECOV_TOKEN (public repo uses tokenless upload)
- Add explicit permissions to build-and-release workflow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented May 7, 2026

Copy link
Copy Markdown

@discreteds discreteds merged commit 457db7f into develop May 7, 2026
3 checks passed
@discreteds discreteds deleted the hotfix/ci-security-pull-request-target branch May 7, 2026 14:35
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.

1 participant