Skip to content

Commit

Permalink
Document Design Rationales for Heuristic Constraint (#516)
Browse files Browse the repository at this point in the history
* Add comment for rationale of heurisitic constraint

* Update comment
  • Loading branch information
jpdakran authored Feb 7, 2022
1 parent 28ee726 commit 4ceff67
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions detect_secrets/filters/heuristic.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def is_indirect_reference(line: str) -> bool:
secret = request.headers['apikey']
"""
# Constrain line length as the heuristic's intention is to target lines that resemble
# function calls. The constraint avoids catastrophic backtracking failures of the regex.
if len(line) > 1000:
return False
return bool(_get_indirect_reference_regex().search(line))
Expand Down

0 comments on commit 4ceff67

Please sign in to comment.