Skip to content

Commit 4ceff67

Browse files
authored
Document Design Rationales for Heuristic Constraint (#516)
* Add comment for rationale of heurisitic constraint * Update comment
1 parent 28ee726 commit 4ceff67

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

detect_secrets/filters/heuristic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ def is_indirect_reference(line: str) -> bool:
165165
166166
secret = request.headers['apikey']
167167
"""
168+
# Constrain line length as the heuristic's intention is to target lines that resemble
169+
# function calls. The constraint avoids catastrophic backtracking failures of the regex.
168170
if len(line) > 1000:
169171
return False
170172
return bool(_get_indirect_reference_regex().search(line))

0 commit comments

Comments
 (0)