Redact secrets from telemetry spans, OAuth logs, and HTTP - #28
Merged
Conversation
…ebug logs Addresses TAVA FSR-DATA-1 (issue 6) and Finding 13 (issue 15). Together these paths could write authorization codes, PKCE verifiers, client secrets, refresh/access tokens, session cookies, and provider credentials to trace or debug-log storage. Changes: - Span scrubber recursively handles mappings and always redacts values under known credential keys (client_secret, refresh_token, code_verifier, etc.); generic assignment matching covers short secrets and OAuth credential names. - OAuth token-exchange failures log only the HTTP status, not the credential-bearing request/response payloads. - HTTP debug logger passes every parsed request/response body through the scrubber before persisting; OAuth authorization-code bodies also treat the `code` field as a credential. Live httpx.Request/Response objects returned to callers are unchanged. - HTTP debug logger redacts request and response headers via the shared sensitive-key classifier, covering Authorization, Cookie/Set-Cookie, Proxy-Authorization, and provider-specific auth headers (X-Api-Key, X-Auth-Token, X-Session-Token, etc.). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Redacts secrets from three log/trace paths that previously wrote credentials to disk:
client_secret,refresh_token, andcode_verifier— so those values could reach exported spans intact.client_secret,code,code_verifier) and the raw provider response on error.Set-Cookie,X-Api-Key,X-Auth-Token,X-Session-Token, etc.) were written in plaintext even though request headers were already redacted.Together these paths could write authorization codes, PKCE verifiers, client secrets, refresh/access tokens, session cookies, and provider credentials to trace or debug-log storage.
Changes
raise ... from e.codefield as a credential. The livehttpx.Request/httpx.Responsereturned to callers is not mutated.Authorization,Cookie/Set-Cookie,Proxy-Authorization, and provider-specific auth headers (X-Api-Key,X-Auth-Token,X-Session-Token, …).Test plan
uv run ruff check .passes on touched filesuv run ruff format --check .passes on touched filesuv run pytest— 6242 passed, 0 failurestests/tracing/test_secret_scrubber.pycover nested mappings, sensitive-key redaction, and short secretstests/unifiedllm/test_http_logging.pycover response-header and body redaction in bothsave_responses(response_*.json) anderrors_only(llm_errors.jsonl) paths