[code-scanning-fix] Fix go/unsafe-quoting: Remove unused environment variable with unsafe JSON embedding#11424
Closed
github-actions[bot] wants to merge 2 commits intomainfrom
Closed
Conversation
…oting Fixes code scanning alert #538 (go/unsafe-quoting) The code was creating a GH_AW_PROJECT_VIEWS environment variable with JSON data embedded using %q, which CodeQL flagged as unsafe quoting. However, this environment variable was never consumed by any JavaScript code - it was dead code. The actual views configuration is properly passed through the GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIG environment variable (see compiler_safe_outputs_config.go:602-608), which uses proper JSON marshaling and %q escaping on line 638. This fix removes the unused code entirely, eliminating the security vulnerability without affecting functionality. CWE-78, CWE-89, CWE-94
Contributor
|
@copilot the string is inserted in YAML not shell. |
Contributor
This was referenced Jan 23, 2026
12 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.
Security Fix: Unsafe JSON Quoting in YAML Environment Variable
Alert Number: #538
Severity: Critical
Rule: go/unsafe-quoting
CWE: CWE-78, CWE-89, CWE-94
Vulnerability Description
CodeQL detected unsafe quoting in
pkg/workflow/update_project_job.goat line 47. The code was embedding JSON data into a YAML environment variable usingfmt.Sprintfwith%qformatting:JSON encoding does not escape single quotes, which could break YAML parsing or be exploited for injection attacks if the JSON contains malicious quote characters.
Location
pkg/workflow/update_project_job.gobuildUpdateProjectJobRoot Cause Analysis
The vulnerability existed in code that created an unused environment variable
GH_AW_PROJECT_VIEWS. Investigation revealed:GH_AW_PROJECT_VIEWSenvironment variable was never consumed by any JavaScript codeGH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIG(seecompiler_safe_outputs_config.go:602-608)%qescaping at line 638Fix Applied
Removed the unused code entirely (lines 42-52 in
update_project_job.go):Changes Made:
GH_AW_PROJECT_VIEWSenvironment variable generationencoding/jsonimportWhy This Fix is Correct:
GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIGSecurity Best Practices
GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIG) instead of scattered environment variablesTesting Considerations
GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIGVerification
After merging, verify:
Automated by: Code Scanning Fixer Workflow
Run ID: 21271253990
Commit: 315dfd1