Skip to content

fix(llm): redact request credentials from provider diagnostics - #271

Open
wolfy-j wants to merge 2 commits into
masterfrom
fix/llm-error-redaction
Open

wolfy-j wants to merge 2 commits into
masterfrom
fix/llm-error-redaction

Conversation

@wolfy-j

@wolfy-j wolfy-j commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Provider clients expose request credentials when an upstream echoes them in an error diagnostic. Redact the exact credentials sent in request headers before error builders log them, before stream callbacks emit chunks, and before errors return to callers. This covers nested diagnostic fields, transport failures, API keys, bearer tokens, signed authorization values and configured headers, including JSON-escaped and URL-encoded forms in serialized diagnostics.

Collect credentials and build redaction matches only when an error needs sanitizing. Successful requests perform no secret collection, header scanning for secrets or sorting. Each stream retains a private redactor for its dispatched request; stream responses expose no credential state. No contract or registry entry changes, and successful content and error return types and surrounding text stay unchanged.

Classification remains after redaction. This changes the kind only when a credential itself contains classifier keywords: a 401 diagnostic echoing a key containing timeout correctly classifies as permission denied after redaction. That corrects a misclassification; it does not change the error contract. Existing native error kinds and retryability remain unchanged.

Validation uses Wippy v0.3.59a: 90 focused provider/transport tests and 255 existing client tests pass. The regression guard fails against the previous revision and passes with the fix in SQLite and PostgreSQL modes. All 33 captured provider warning records are sanitized. Lint checks all 145 entries with no issues. Coverage, issue audit, scenario map and module manifest checks pass.

@wolfy-j
wolfy-j requested a review from skhaz November 15, 2026 17:53
@wolfy-j
wolfy-j requested a review from skhaz November 15, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants