3 Commits

Author SHA1 Message Date
Maciej Lisiewski
41329c0302 fix(credential-pool): mask the row's own secrets in recorded error text
The pattern redactor cannot recognise an opaque key (random hex from a
custom provider), so a provider echoing it back ('Invalid API key: <key>')
still reached auth.json via last_error_message/last_error_reason — even
for borrowed rows whose secret the sanitizer otherwise strips. Replace the
failing row's access/refresh/agent key verbatim before the force-redact
pass, on both the exhaustion and mark-dead writers.

Refs #71994
2026-11-13 17:20:18 -08:00
Maciej Lisiewski
c1c8f52ddf fix(credential-pool): force-redact last_error_reason too
A body whose "error" is a bare string ("Incorrect API key provided: ...")
becomes the error context's reason as well as its message, and reason is
persisted to auth.json as last_error_reason, which the sanitizer keeps.
Redact both fields in _normalize_error_context; terminal reason codes
(invalid_grant etc.) are unchanged by redaction.

Fixes #71994
2026-11-13 17:20:18 -08:00
Maciej Lisiewski
4dfdb27fa6 fix(credential-pool): force-redact every last_error_message writer
Follow-up to the salvaged #72015 commit: pass force=True (auth.json is a
persistence boundary, so security.redact_secrets: false must not let an
echoed key through) and redact the mark-dead refresh path, which stored
str(exc) verbatim. _normalize_error_context moves to
agent/credential_pool_errors.py to keep the facade under its size cap.

Fixes #71994
2026-11-13 17:20:18 -08:00