-
Notifications
You must be signed in to change notification settings - Fork 189
metavariable-comparison returns 0 findings when comparison contains 3+ OR terms #585
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
metavariable-comparison returns 0 findings when comparison contains 3+ OR terms
To Reproduce
metavariable-comparison stops matching when the comparison expression uses or with three or more disjuncts. With 1 or 2 OR-terms it works, but with 3+ it returns 0 findings.
A similar story was discussed here semgrep/semgrep#11209
Expected behavior
The comparison should be evaluated (and match in the given example) regardless of the number of terms in the expression.
rules:
- id: bug
languages: [python]
severity: WARNING
message: test
patterns:
- pattern: |
foo($A, $B, $C)
# works
- metavariable-comparison:
metavariable: $A
comparison: $A < 16
# works
# - metavariable-comparison:
# metavariable: $A
# comparison: $A < 16 or $B < 0
# fails: 0 findings
# - metavariable-comparison:
# metavariable: $A
# comparison: $A < 16 or $B < 0 or $C > 0
def foo(a, b, c):
pass
foo(1, -1, 1)What is the priority of the bug to you?
- P0: blocking your adoption of Opengrep or workflow
- P1: important to fix or quite annoying
- P2: regular bug that should get fixed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working