Skip to content

Commit

Permalink
Fix Catastophic Backtracking for Indirect Reference (#509)
Browse files Browse the repository at this point in the history
* Update regex to avoid catastrophic backtracking

* Keep regex the same. Only run heuristic for lines that are less than 1k char since that better suits the intention of the heuristic
  • Loading branch information
jpdakran committed Feb 2, 2022
1 parent 5484c1b commit af04c48
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']
"""
if len(line) > 1000:
return False
return bool(_get_indirect_reference_regex().search(line))


Expand Down

0 comments on commit af04c48

Please sign in to comment.