Commit Graph

1 Commits

Author SHA1 Message Date
Maciej Lisiewski
fac38a9ee7 fix(redact): mask Google OAuth client secrets and access tokens by prefix
A client_secret.json pasted into a chat lands in gateway.log via the
inbound-message preview, cut at 80 chars mid-JSON. The JSON-field pass
needs a closing quote and the prefix pass had no GOCSPX-/ya29. family,
so the live secret survived both the log formatter and the forced
debug-share redaction and reached the public paste.

Add both vendor prefixes to _PREFIX_PATTERNS, so every redaction
surface (log formatter, debug share, tool output) masks them without a
secret-named key beside them. ya29. allows one dotted type letter
because service-account/GCE tokens are ya29.c.… and STS federated
tokens ya29.d.…; the body class has no '.', so a plain ya29. pattern
stopped at the second dot. GOCSPX- takes an 8-char floor so a secret
cut short by the 80-char preview is still masked. The pattern-shape
validators move to agent/redact_pattern_shape.py to keep
agent/redact.py under the file-size cap.

Whether INFO logs should carry message text at all is left for the
maintainer (logging-policy question, see #46006).

Refs #64351
2026-11-12 21:34:14 +01:00