diff --git a/turnstone/core/output_guard.py b/turnstone/core/output_guard.py index 757f92ae..5d1fc7cd 100644 --- a/turnstone/core/output_guard.py +++ b/turnstone/core/output_guard.py @@ -142,9 +142,12 @@ _CREDENTIAL_PATTERNS: list[tuple[re.Pattern[str], str]] = [ # The trailing _? allows both snake_case and compact forms (api_key / apikey). # Bare key=/token= are included as alternatives so standalone assignments like # key=<20+ chars> still match. + # Multi-segment keys like secret_access_key and aws_secret_access_key are + # included explicitly so the prefix doesn't leak as "secret_". ( re.compile( - r"(?:(?:api|secret|session|auth|encryption|signing|private|public|access)_?key|" + r"(?:(?:api|secret|session|auth|encryption|signing|private|public|access|" + r"secret_access|aws_secret_access)_?key|" r"(? (20+). Same bounded prefix approach: api_key=/secret_key= etc. // but not monkey= or turkey=. Bare "key=" included with negative lookbehind. - // The _? allows both snake_case and compact forms. - [/(?:(?:api|secret|session|auth|encryption|signing|private|public|access)_?key|(?