[security-fix] Security Fix: Unsafe quoting in validation error messages (Alert #19) #1703
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 Quoting in Validation Error Messages
Alert Number: #19
Severity: Critical
Rule: go/unsafe-quoting (CodeQL)
File:
pkg/workflow/validation.go:35Vulnerability Description
CodeQL identified a potentially unsafe quoting vulnerability in the
validateExpressionSizesfunction. The code was constructing an error message with user-controlled input (YAML key names) embedded directly into a single-quoted string without proper escaping:If a YAML key contains a single quote character, it could prematurely close the surrounding string literal, potentially changing the structure of the error message. While this specific instance has limited direct security impact (error messages), following secure coding practices prevents this pattern from being replicated in more sensitive contexts.
Fix Applied
Changed the format specifier from
'%s'to%qwhich properly quotes and escapes the string according to Go syntax:Security Best Practices
%qformat verb automatically escapes special characters including quotes, backslashes, and control charactersTesting Considerations
Generated with Claude Code