Skip to content

fix: replace pull_request_target with pull_request to prevent secret exposure#21

Merged
kparkinson-ld merged 1 commit intomainfrom
devin/1770661593-fix-pull-request-target-security
Feb 9, 2026
Merged

fix: replace pull_request_target with pull_request to prevent secret exposure#21
kparkinson-ld merged 1 commit intomainfrom
devin/1770661593-fix-pull-request-target-security

Conversation

@kparkinson-ld
Copy link
Contributor

Summary

Remediates a security vulnerability (HackerOne #3545260) where the style-check.yml workflow used pull_request_target combined with explicit checkout of fork-controlled code (repository and ref parameters). This allowed fork PRs to execute attacker-controlled code with base repository privileges and access to secrets including GITHUB_TOKEN.

Changes:

  • Replaced pull_request_target trigger with pull_request so fork PRs run in the fork's security context
  • Removed unsafe repository: ${{ github.event.pull_request.head.repo.full_name }} and ref: ${{ github.head_ref }} from checkout steps in eslint_check_upload, prettier_check, and prettier jobs
  • Updated the annotation job condition from pull_request_target to pull_request
  • Retained ref: ${{ github.head_ref }} in the prettier job (which is gated to same-repo PRs only and needs it for auto-commit)

Review & Testing Checklist for Human

  • Verify the prettier job condition (github.event.pull_request.head.repo.full_name == 'rrweb-io/rrweb') correctly restricts it to same-repo PRs only — this job retains ref and contents: write
  • Confirm the annotation job (which uses checks: write + secrets.GITHUB_TOKEN) will still function for same-repo PRs under the pull_request event. Note: annotations on fork PRs may stop working, which is the expected security trade-off
  • Check that no other workflow files in .github/workflows/ have the same pull_request_target + fork checkout pattern

Suggested test plan: Open a PR from a fork to confirm the workflow no longer checks out fork code with base repo privileges. Verify same-repo PRs still get ESLint annotations and auto-formatting.

Notes

…exposure

Change the workflow trigger from pull_request_target to pull_request
to prevent fork PRs from executing attacker-controlled code with base
repository privileges and access to secrets.

- Remove unsafe checkout of fork code (repository/ref parameters)
- Update annotation job condition to match new event name
- Keep ref parameter in prettier job for same-repo PRs only

Co-Authored-By: Kane Parkinson <kparkinson@launchdarkly.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@kparkinson-ld kparkinson-ld marked this pull request as ready for review February 9, 2026 18:42
@kparkinson-ld kparkinson-ld requested a review from a team February 9, 2026 18:42
@kparkinson-ld kparkinson-ld merged commit cf0258e into main Feb 9, 2026
9 of 18 checks passed
@kparkinson-ld kparkinson-ld deleted the devin/1770661593-fix-pull-request-target-security branch February 9, 2026 18:43
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