✨ Detect more untrusted context patterns in Dangerous-Workflow check - #5127
Open
darkknight8670 wants to merge 1 commit into
Open
✨ Detect more untrusted context patterns in Dangerous-Workflow check#5127darkknight8670 wants to merge 1 commit into
darkknight8670 wants to merge 1 commit into
Conversation
Signed-off-by: Vikas Barupal <barupalrekha3@gmail.com>
darkknight8670
requested review from
jeffmendoza and
spencerschrock
and removed request for
a team
July 16, 2026 17:29
darkknight8670
marked this pull request as draft
July 18, 2026 06:01
darkknight8670
marked this pull request as ready for review
July 18, 2026 06:02
Author
|
Hi maintainers! This PR expands the Dangerous-Workflow check by detecting additional untrusted context patterns that were previously missed and includes tests for the new cases. I'd appreciate a review when you have time. Thanks! |
|
This pull request has been marked stale because it has been open for 10 days with no activity |
Author
|
Hi maintainers! This PR is still ready for review. It adds additional untrusted context patterns to the Dangerous-Workflow check along with tests. I'd appreciate a review when someone has time. Thanks! |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Improvement to the Dangerous-Workflow check (script injection detection).
Fixes #3915
What is the current behavior?
containsUntrustedContextPatterninchecks/raw/dangerous_workflow.gomissesseveral attacker-controlled GitHub event context fields, so workflows
interpolating them into
run:scripts are not flagged as script-injectionrisks. Examples not detected:
github.event.fork.forkee.name(and other forkee fields)github.event.workflow_run.head_branchWhat is the new behavior?
The untrusted-input pattern now also detects the following fields, which are
attacker-controlled per GitHub's webhook events and payloads docs
and the GitHub Security Lab untrusted-input research:
forkevent — anyone can fork a repo and controls the fork's metadata:fork.forkee.namefork.forkee.full_namefork.forkee.descriptionfork.forkee.homepagefork.forkee.default_branchworkflow_runevent — attacker controls these via the triggering PR/branch:workflow_run.head_branchworkflow_run.display_titleworkflow_run.head_repository.descriptionworkflow_run.pull_requests[*].head.refNote:
issue_comment.comment.bodyandcommit_comment.comment.bodymentionedin #3915 were already detected by the existing
comment\.bodypattern — this PRadds regression tests to cover them explicitly.
Unit tests added for all new patterns, including negative cases
(
fork.forkee.id,workflow_run.id) to guard against over-matching.Which issue(s) this PR fixes
Fixes #3915
Special notes for your reviewer
The field list was derived from GitHub's webhook payload documentation; happy
to add further fields (e.g. other free-text fields from less common events) if
reviewers think the coverage should be broader.
Does this PR introduce a user-facing change?