Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Fix] Square brackets bypass Issue #857
  • Loading branch information
tsigouris007 committed Jul 2, 2025
commit 35f94b824ec3b60440e3c25b67808edbea3893e3
10 changes: 9 additions & 1 deletion detect_secrets/filters/heuristic.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,15 @@ def _get_indirect_reference_regex() -> Pattern:
# [^\v]* -> Something except line breaks
# [\]\)] -> End of indirect reference: ] or )
# )
return re.compile(r'([^\v=!:]*)\s*(:=?|[!=]{1,3})\s*([\w.-]+[\[\(][^\v]*[\]\)])')
return re.compile(
r'([^\v=!:"<%>]*)\s*(:=?|[!=]{1,3}|\|\|)\s*('
r'[\w.-]+[\[\(][^\v]*[\]\)]' # Matches ENV[...] or similar references
r'|'
r'\'[^\']*\'' # Matches single-quoted strings
r'|'
r'"[^"]*"' # Matches double-quoted strings
r')'
)


def is_lock_file(filename: str) -> bool:
Expand Down