Skip to content

Comments

Fix PWN vulnerability in workflow files#4657

Open
jun06t wants to merge 2 commits intoprebid:masterfrom
ajainc:fix/pwn-vulnerability-workflow
Open

Fix PWN vulnerability in workflow files#4657
jun06t wants to merge 2 commits intoprebid:masterfrom
ajainc:fix/pwn-vulnerability-workflow

Conversation

@jun06t
Copy link

@jun06t jun06t commented Jan 13, 2026

Summary

  • Fix PWN (Poisoned Pipeline Execution) vulnerability in adapter-code-coverage.yml and semgrep.yml
  • Change pull_request_target trigger to pull_request
  • Remove explicit PR code checkout (ref/repository parameters)

Background

When using pull_request_target trigger with checkout of PR code, malicious PRs from forks can execute code with access to base repository secrets.

Workflow Analysis

Workflow Uses pull_request_target Checkouts PR Code Status Reason
adapter-code-coverage.yml Yes Yes (head.ref) Fixed Vulnerable - PR code executed with secrets access
semgrep.yml Yes Yes (head.ref) Fixed Vulnerable - PR code executed with secrets access
code-path-changes.yml Yes No (default) Not changed Safe - only checkouts base repo code, changing would break notification for fork PRs
cross-repo-issue.yml Yes No (none) Not changed Safe - no checkout, only uses PR metadata, changing would break cross-repo issue creation for fork PRs
security.yml No (pull_request) - Not changed Already using safe trigger
validate.yml No (pull_request) - Not changed Already using safe trigger

Changes

File Change
adapter-code-coverage.yml pull_request_targetpull_request, remove ref/repository params
semgrep.yml pull_request_targetpull_request, remove ref/repository params

Test plan

  • Verify adapter-code-coverage workflow runs correctly
  • Verify semgrep workflow runs correctly

paths: ["adapters/*/*.go"]

permissions:
contents: read
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write access is required because the results of the code coverage scan are uploaded to a branch for viewability. Does this PR offer a safer alternative?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SyntaxNode, @jun06t,
I responsibly disclosed this vulnerability via email (and not through a public PR), specifically to avoid exposing the details to the world and to prevent potential abuse. It’s been over a week and I haven’t received a response yet.

Could you please confirm whether this fix is related to my disclosure?

Screenshot 2026-01-14 at 0 45 46

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SyntaxNode
Thanks for your review.
I've just fixed it.

@barakharyati
Thank you for your report.
I'm not a member of the Prebid team, but this fix addresses that vulnerability.
Since I wasn't able to create a repository security advisory in this repository, I created this PR instead.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SyntaxNode
Now that it's public, I strongly recommend turning off the vulnerable workflows ASAP until they're fixed.

@jun06t, if you run it in PR and not PRT, the Job will not have access to the base repo for any update.
Running checkout without the head ref will scan the base repo code.
The right way to solve is to separate Jobs,
First Job with no permission that will run the tainted code that will create an artifact or output
Second, with permissions that will download the artifact or output and commit \ change PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@barakharyati
Thank you for your suggestion.
I've split the workflow into two stages. Could you please verify if this implementation aligns with your intention?

Change pull_request_target to pull_request trigger and remove explicit
checkout of PR head ref to prevent potential code injection attacks.

- adapter-code-coverage.yml: Change trigger and remove ref/repository params
- semgrep.yml: Change trigger and remove ref/repository params
@jun06t jun06t force-pushed the fix/pwn-vulnerability-workflow branch from d203747 to 15b8df9 Compare January 14, 2026 01:53
Split the workflow into two stages for better security:

Stage 1 (adapter-code-coverage.yml):
- Runs on pull_request trigger with read-only permissions
- Executes coverage tests on PR code
- Uploads coverage results and PR metadata as artifacts

Stage 2 (adapter-code-coverage-upload.yml):
- Runs on workflow_run trigger after stage 1 completes
- Has write permissions but never executes PR code
- Downloads artifacts, commits to coverage-preview branch
- Posts coverage summary comment to PR

This approach prevents untrusted PR code from accessing repository
secrets while maintaining full functionality for fork PRs.
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.

3 participants