Skip to content

[ci] Don't use pull_request_target #32708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 21, 2025
Merged

[ci] Don't use pull_request_target #32708

merged 2 commits into from
Mar 21, 2025

Conversation

poteto
Copy link
Member

@poteto poteto commented Mar 21, 2025

pull_request_target gives access to repository secrets and permissions for use from forks, for example to add a comment.

Due to the dangers inherent to automatic processing of PRs, GitHub’s standard pull_request workflow trigger by default prevents write permissions and secrets access to the target repository. However, in some scenarios such access is needed to properly process the PR. To this end the pull_request_target workflow trigger was introduced.

The reason to introduce the pull_request_target trigger was to enable workflows to label PRs (e.g. needs review) or to comment on the PR.

(via https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/)

In this case there is no reason for us to allow this, so let's just use the normal pull_request trigger which is less permissive.

Stack created with Sapling. Best reviewed with ReviewStack.

@react-sizebot
Copy link

react-sizebot commented Mar 21, 2025

Comparing: fe8c106...399224e

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 515.14 kB 515.14 kB = 91.74 kB 91.74 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 615.53 kB 615.53 kB = 108.89 kB 108.89 kB
facebook-www/ReactDOM-prod.classic.js = 651.48 kB 651.48 kB = 114.89 kB 114.89 kB
facebook-www/ReactDOM-prod.modern.js = 641.76 kB 641.76 kB = 113.31 kB 113.31 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 399224e

poteto added a commit that referenced this pull request Mar 21, 2025
Missed these ones earlier.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32707).
* #32708
* __->__ #32707
poteto added 2 commits March 21, 2025 16:10
`pull_request_target` gives access to repository secrets and permissions for use from forks, for example to add a comment.

> Due to the dangers inherent to automatic processing of PRs, GitHub’s standard pull_request workflow trigger by default prevents write permissions and secrets access to the target repository. However, in some scenarios such access is needed to properly process the PR. To this end the pull_request_target workflow trigger was introduced.

> The reason to introduce the pull_request_target trigger was to enable workflows to label PRs (e.g. needs review) or to comment on the PR.

(via https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/)

In this case there is no reason for us to allow this, so let's just use the normal `pull_request` trigger which is less permissive.
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Mar 21, 2025
poteto added a commit that referenced this pull request Mar 21, 2025
Missed one
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32709).
* #32708
* __->__ #32709
@poteto poteto merged commit 156f0ec into main Mar 21, 2025
245 of 247 checks passed
@poteto poteto deleted the pr32708 branch March 21, 2025 20:17
poteto added a commit to reactjs/react.dev that referenced this pull request Mar 21, 2025
Defaults permissions to none for all workflows, and only request extra permissions when needed.

Similar to facebook/react#32708, prefer the less permissive `pull_request` trigger instead.
poteto added a commit to reactjs/react.dev that referenced this pull request Mar 21, 2025
Defaults permissions to none for all workflows, and only request extra permissions when needed.

Similar to facebook/react#32708, prefer the less permissive `pull_request` trigger instead.
poteto added a commit to reactjs/react.dev that referenced this pull request Mar 21, 2025
* [ci] Fix permissions and don't use pull_request_target

Defaults permissions to none for all workflows, and only request extra permissions when needed.

Similar to facebook/react#32708, prefer the less permissive `pull_request` trigger instead.

* [ci] Pin 3rd party actions to specific hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants