🐛 detect toJSON(github.event) in Dangerous-Workflow check#4898
Merged
spencerschrock merged 3 commits intoossf:mainfrom Jan 9, 2026
Merged
🐛 detect toJSON(github.event) in Dangerous-Workflow check#4898spencerschrock merged 3 commits intoossf:mainfrom
spencerschrock merged 3 commits intoossf:mainfrom
Conversation
Signed-off-by: Heath Dutton🕴️ <heathdutton@gmail.com>
spencerschrock
approved these changes
Jan 8, 2026
Member
spencerschrock
left a comment
There was a problem hiding this comment.
I think if we just focus on toJSON(github) and to.JSON(github.event) (and not any other subfields) we avoid false positives for now, while we think of how to get the specificity right.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4898 +/- ##
==========================================
+ Coverage 66.80% 69.70% +2.90%
==========================================
Files 230 251 +21
Lines 16602 15652 -950
==========================================
- Hits 11091 10911 -180
+ Misses 4808 3867 -941
- Partials 703 874 +171 🚀 New features to boost your workflow:
|
Signed-off-by: Heath Dutton🕴️ <heathdutton@gmail.com>
Member
|
/scdiff generate Dangerous-Workflow |
thomasleplus
pushed a commit
to thomasleplus/scorecard
that referenced
this pull request
Mar 8, 2026
* 🐛 detect toJSON(github.event) in Dangerous-Workflow check Signed-off-by: Heath Dutton🕴️ <heathdutton@gmail.com> * address review: only match exact toJSON(github) and toJSON(github.event) Signed-off-by: Heath Dutton🕴️ <heathdutton@gmail.com> --------- Signed-off-by: Heath Dutton🕴️ <heathdutton@gmail.com>
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?
Bug fix
What is the current behavior?
The Dangerous-Workflow check does not detect script injection vulnerabilities when
toJSON(github.event)ortoJSON(github)is used in workflow run steps. These serialize the entire event/context object which contains attacker-controlled data.What is the new behavior (if this is a feature change)?
The check now detects
toJSON(github.event)andtoJSON(github)patterns as dangerous, including case variations and whitespace.Which issue(s) this PR fixes
Fixes #3554
Special notes for your reviewer
The regex
(?i)tojson\s*\(\s*github(\s*\)|\.event)matches:toJSON(github)- serializes entire context including eventtoJSON(github.event)andtoJSON(github.event.*)- serializes event dataIt correctly ignores safe patterns like
toJSON(github.repository).Does this PR introduce a user-facing change?