-
Notifications
You must be signed in to change notification settings - Fork 2.3k
CI: Patch critical security issue in linter.yml #14319
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
Conversation
`pull_request_target` is a critical security issue because it authorizes full write access to the repo in a privileged context. When combined with `npm ci`, malicious `package.json` scripts from untrusted PRs can execute with repository write permissions and access to secrets. This could allow attackers to modify the codebase or retrieve credentials. Full write access is *not* required to post a comment, so we can just use `pull_request` instead of `pull_request_target`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5809a1e93
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| on: | ||
| pull_request_target: | ||
| pull_request: | ||
| branches: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore write-capable event for PR comment step
Switching this workflow to pull_request means that for forked PRs the GITHUB_TOKEN is read‑only, so the github.rest.issues.createComment step later in this file will fail (403) and the job will error instead of posting the lint delta. This regression shows up whenever the PR comes from a fork, which is the common external contribution path for Prebid.js.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses a critical security vulnerability in the linter workflow by changing the trigger from pull_request_target to pull_request. The pull_request_target event runs with write access to the repository and can execute untrusted code from malicious PRs through npm ci scripts, creating a significant security risk. The change to pull_request runs the workflow in a restricted context without write access to the repository.
- Changes the GitHub Actions workflow trigger from
pull_request_targettopull_requestto prevent malicious code execution with elevated privileges
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,7 +1,7 @@ | |||
| name: Check for linter warnings / exceptions | |||
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title contains a spelling error: "secuirt" should be "security".
| @@ -1,7 +1,7 @@ | |||
| name: Check for linter warnings / exceptions | |||
|
|
|||
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When changing from pull_request_target to pull_request, you need to add explicit permissions for the workflow to post comments. Without explicit permissions, pull_request events have read-only access by default. Add a permissions block at the job or workflow level with pull-requests: write to allow the workflow to create comments on the PR.
| permissions: | |
| pull-requests: write |
|
context, raptie got a code scanning alert in our fork from github codeql Code scanning alerts #3 Potential execution of untrusted code on a privileged workflow (pull_request_target Rule Recommendation The artifacts downloaded from the first workflow should be considered untrusted and must be verified. Example on: pull_request_target jobs: Correct Usage ReceivePR.yml (untrusted PR handling with artifact creation): name: Receive PR name: Comment on the pull request |
| name: Check for linter warnings / exceptions | ||
|
|
||
| on: | ||
| pull_request_target: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see https://github.com/prebid/Prebid.js/pull/14330/files/1314edff69ba01ccf652e2b249ebfaeb8e50f5f6#r2690999520 (a very similar PR) - from my testing this breaks the workflow on PRs from forks, I'm going to try using workflow_run but am interested in any other ideas you might have.
|
Closing this in favor of #14339 |
Type of change
Bugfix
Feature
New bidder adapter
Updated bidder adapter
Code style update (formatting, local variables)
Refactoring (no functional changes, no api changes)
Build related changes
CI related changes
Does this change affect user-facing APIs or examples documented on http://prebid.org?
Other
Description of change
pull_request_targetis a critical security issue because it authorizes full write access to the repo in a privileged context. When combined withnpm ci, maliciouspackage.jsonscripts from untrusted PRs can execute with repository write permissions and access to secrets. This could allow attackers to modify the codebase or retrieve credentials.Full write access is not required to post a comment, so we can just use
pull_requestinstead ofpull_request_target.Other information