fix(CommandInjection): only throw on usages of github.event.|inputs#5
Merged
6f6d6172 merged 6 commits intoAug 12, 2025
Conversation
6f6d6172
reviewed
Aug 12, 2025
Co-authored-by: Omar A. <47008591+6f6d6172@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the CommandInjection rule to be more precise in detecting potential security vulnerabilities by only flagging usages of github.event. and inputs. properties (with dots) rather than any reference to github.event or inputs.
- Updated the regex pattern to require a dot after
github.eventandinputsto avoid false positives - Removed the requirement for spaces around the expression braces to catch more injection patterns
- Added test coverage for both the new detection pattern and the exclusion of safe properties like
github.event_name
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/claws/rule/command_injection.rb | Updated regex pattern to only match github.event. and inputs. with dots, removing space requirements |
| spec/claws/rule/command_injection_spec.rb | Added tests for expressions without spaces and verification that github.event_name doesn't trigger violations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
6f6d6172
approved these changes
Aug 12, 2025
6f6d6172
left a comment
Contributor
There was a problem hiding this comment.
platform lgtm
domain lgtm
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.
I ran into a case where a PR was failing
clawsdue to usinggithub.event_namewhich should be entirely safe. I down-scoped theCommandInjectionrule to only violate onrunusages ofgithub.event\.(newly modified regex) andinputs(existing regex) and added a spec to ensure non-inputs checks don't violate.Note: This would still cause violations on things like
github.event.pull_request.numberwhich aren't user-generated and should be safe, but since it's impossible(?) to enumerate all of the non-free-form/user-generated fields on the event object, this change at least gives us things likegithub.event_name. Also, you can still useenvas a way to safely use these properties.