Skip to content

Commit

Permalink
fix: simplify external input patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
elsapet committed May 14, 2024
1 parent fd99be4 commit f3435f0
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions rules/python/lang/os_command_injection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ patterns:
- variable: EXTERNAL_INPUT
detection: python_shared_common_external_input
scope: result
- pattern: subprocess.$<METHOD>($<SUBPROC_EXTERNAL_INPUT>$<...>)
- pattern: subprocess.$<METHOD>($<EXTERNAL_INPUT>$<...>)
filters:
- variable: METHOD
values:
Expand All @@ -31,8 +31,8 @@ patterns:
- check_output
- run
- Popen
- variable: SUBPROC_EXTERNAL_INPUT
detection: python_lang_os_command_injection_external_input_subproc
- variable: EXTERNAL_INPUT
detection: python_shared_common_external_input
scope: result
- pattern: $<OS>.$<METHOD>($<_>, $<...>$<EXTERNAL_INPUT>$<...>, $<...>)
filters:
Expand Down Expand Up @@ -92,19 +92,6 @@ auxiliary:
patterns:
- os
- __import__("os")
- id: python_lang_os_command_injection_external_input_subproc
patterns:
- pattern: $<...>$<EXTERNAL_INPUT>$<...>
filters:
- variable: EXTERNAL_INPUT
detection: python_shared_common_external_input
scope: result
- pattern: |
[$<...>$<EXTERNAL_INPUT>$<...>]
filters:
- variable: EXTERNAL_INPUT
detection: python_shared_common_external_input
scope: result
languages:
- python
severity: critical
Expand Down

0 comments on commit f3435f0

Please sign in to comment.