-
-
Notifications
You must be signed in to change notification settings - Fork 8
fix(updater): Prevent script injection vulnerabilities #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add input validation and use environment variables instead of direct interpolation to prevent potential script injection attacks through user-controlled workflow inputs. - Add validate-inputs job to check for safe characters in inputs.name and inputs.path - Move all environment variable declarations to job level for better organization - Replace direct interpolation in PR titles and PowerShell scripts with env variables - Ensure all user inputs are properly sanitized before use 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Split the single validation step into two distinct steps for better clarity and more granular error reporting: - Validate dependency name - Validate dependency path Each step now also logs a success message when validation passes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Fix the regex pattern to properly match spaces in dependency names by using the [:space:] POSIX character class instead of a literal space in the regex pattern. This fixes CI failures for test cases that include spaces in the dependency name like "Workflow args test script". 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Move hyphens to the end of character classes in regex patterns to ensure they are treated as literal characters rather than ranges. This fixes validation failures for inputs containing hyphens like "WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE". 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Convert the validation steps from Bash to PowerShell for consistency with the rest of the workflow which uses PowerShell as its default shell. - Use PowerShell's -notmatch operator instead of Bash regex - Use Write-Output instead of echo - Maintain the same validation logic and error messages 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Add entry to CHANGELOG.md documenting the security improvements to prevent script injection vulnerabilities in the updater workflow. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
| run: | | ||
| $mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value | ||
| $prBranch = switch ('${{ inputs.pr-strategy }}') | ||
| $prBranch = switch ($env:PR_STRATEGY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this also have double-quotes around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no because we can just switch directly on the variable value instead of converting it to string (which it is anyway), and actually I don't think we should be quoting in the step above, let me check
Co-authored-by: J-P Nurmi <[email protected]>
Summary
Prevent script injection vulnerabilities in the
updater.ymlworkflow by validating inputs and using environment variables instead of direct interpolation.Security Fixes
validate-inputsjob to ensureinputs.nameandinputs.pathonly contain safe charactersChanges
${{ env.* }}or$env:*instead of direct${{ inputs.* }}Test Results
Fixes potential command injection through crafted workflow inputs.
🤖 Generated with Claude Code