Skip to content

Conversation

@caugner
Copy link
Contributor

@caugner caugner commented Oct 29, 2025

Description

Update all workflows using pull_request_target to specify trusted target branches, such as main.

Motivation

Security best practice to limit pull_request_target workflows to trusted branches, reducing the attack surface for malicious pull requests.

The pull_request_target trigger causes the workflow to run in the context of the base branch with access to secrets, so it's important:

  • to specify only trusted branches, to avoid that the workflow runs on an untrusted branch,
  • to specify all trusted branches, to avoid that the workflow is skipped on PRs targeting a trusted branch.

Additional details

See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target

Related issues and pull requests

Part of mdn/fred#1021.

@caugner caugner requested review from a team and LeoMcA and removed request for a team October 29, 2025 17:19
@github-actions github-actions bot added system [PR only] Infrastructure and configuration for the project size/xs [PR only] 0-5 LoC changed labels Oct 29, 2025
@caugner caugner marked this pull request as ready for review October 29, 2025 17:30
@caugner caugner requested a review from a team as a code owner October 29, 2025 17:30
@caugner caugner requested review from argl and removed request for LeoMcA October 29, 2025 17:30
@argl argl merged commit abe59ef into main Oct 30, 2025
11 checks passed
@argl argl deleted the pull-request-target-branches branch October 30, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs [PR only] 0-5 LoC changed system [PR only] Infrastructure and configuration for the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants