Actions: Avoid output-clobbering alerts for JSON-encoded jq output - #22252
Open
JarLob wants to merge 2 commits into
Open
Actions: Avoid output-clobbering alerts for JSON-encoded jq output#22252JarLob wants to merge 2 commits into
JarLob wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refines the output-clobbering query to recognize JSON-encoded jq output while preserving alerts for raw-output modes.
Changes:
- Adds
jqoutput-mode detection. - Adds regression workflows and expected results.
- Documents the analysis improvement.
Show a summary per file
| File | Description |
|---|---|
OutputClobberingQuery.qll |
Excludes recognized JSON-encoded jq output. |
.github/workflows/output2.yml |
Adds safe and vulnerable jq cases. |
OutputClobberingHigh.expected |
Updates expected query results. |
2026-07-29-output-clobbering-jq-precision.md |
Adds the change note. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Medium
Contributor
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (1)
actions/ql/test/query-tests/Security/CWE-074/.github/workflows/output2.yml:66
- This safe case needs a vulnerable pipeline control.
getACommand()splits pipelines, so forjq '.value' pr-number.json | tr -d '"'the matchedclobbering_cmdis still the safe-lookingjqsegment and this PR suppresses the statement, even though the downstream command removes JSON quoting and can emit a workflow command. Restrict suppression to cases where thejqoutput reaches the runner unchanged, and add this regression case.
# NOT VULNERABLE: jq emits JSON-encoded strings by default
jq '.value' pr-number.json
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Medium
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.
Reduce false positives from the experimental
actions/output-clobbering/highquery whenjqoutput can be conservatively proven to remain JSON-encoded.The query recognizes a bounded set of safe command forms:
Unrecognized commands remain reportable. In particular, the query continues to report:
-r,-j,--raw-output,--raw-output0, and--join-outputstderrorhalt_errorThis intentionally favors avoiding false negatives over suppressing every safe
jqinvocation.