Repository navigation
feat(command-injection): title option injections and record the injection kind (#220) - #232
Merged
Merged
Conversation
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.
Summary
Keeps the rule id
command-injectionfor every case, so existing suppressions and baselines keep matching (#220). When the rule reads the command element by element and establishes what the attacker's input is, the finding carries aninjectionmetadata field:command: the input runs or chooses what runs (shell string, program, operand run as a command, value of an option that runs it); titleCommand injection;option: the input can only reach the program as an option or as the value of an option not established to run it (cases 4, 5b, 5c, 7 of command-injection: severity of option injection in argument lists run without a shell #208); titleOption injection.When the kind cannot be established (an option whose effect is to review, an unknown program or element before the input, a command that is not a list or tuple display, a sink such as
os.systemnot read element by element), the field is absent and the title staysCommand injection.Assessmentgains optionaltitleandmetadatafields (plugin API, backward compatible). Documented indocs/usage.mdanddocs/plugins.md. The SARIF report does not carry finding metadata today, so the field appears in the JSON report.Verification
New tests in
tests/test_command_injection_nature.py(red before the change), including an inlineignore[command-injection]suppressing an option injection. No existing test changed. Full suite green apart from the localtest_packagingenvironment issue; ruff, mypy clean; regression snapshots unchanged; mitmproxy scan: same 75 findings (rule, severity, confidence, location), titles of three option cases changed.Closes #220