Skip to content

Commit

Permalink
Add comment for rationale of heurisitic constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Paul Dakran committed Feb 7, 2022
1 parent 2f4f956 commit 860da07
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']
"""
# Constain lines as the heuristics intention is to target relatively short function like strings
# This constraint also 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 860da07

Please sign in to comment.