Skip to content

fix(auth): keep client secrets out of debug logs - #1046

Open
LinoGiger wants to merge 1 commit into
mainfrom
fix(auth)/keep-client-secrets-out-of-debug-logs
Open

LinoGiger wants to merge 1 commit into
mainfrom
fix(auth)/keep-client-secrets-out-of-debug-logs

Conversation

@LinoGiger

Copy link
Copy Markdown
Collaborator

Why

CredentialManager.get_client_credentials() logged every saved credential at DEBUG, client secret included. The rapidata logger runs at DEBUG so the OTLP handler receives every record, and it propagates, so the same record also reaches any handler the application put on the root logger (logging.basicConfig()), whatever level the application asked for.

Flow

flowchart LR
  client["RapidataClient()"] --> cm["CredentialManager.get_client_credentials"]:::changed
  cm ==>|"logger.debug (display string, no secret)"| log["rapidata logger (DEBUG)"]
  log -->|"OTLP handler"| otlp["otlp-sdk collector"]
  log -->|"propagate"| app["application root handlers"]
  classDef new fill:#d3f9d8,stroke:#2f9e44,color:#000
  classDef changed fill:#fff3bf,stroke:#f08c00,color:#000
  classDef removed fill:#ffe3e3,stroke:#e03131,color:#000,stroke-dasharray:4
Loading

Decisions

  • Field(repr=False) on ClientCredential.client_secret, so no later %s of the model can print it. model_dump and the credentials file are unchanged; SecretStr was rejected because it changes how the file is written and read.
  • The Stored credentials line is removed, not redacted: it listed the credentials of every environment on each client construction.

Verified

test_client_secret_stays_out_of_repr_and_debug_logs fails on main and passes here. With logging.basicConfig(level=logging.WARNING) and a credentials file holding a fake secret, the root handler printed the secret before the change and no longer does.

Agent skill: nothing the skill documents changed, so this needs the skill-unchanged-approved label.

🔗 Session: https://poseidon.rapidata.internal/chat/ves-167c2yznsvyzh9

🤖 Generated with Claude Code

get_client_credentials() logged every saved credential at DEBUG, client
secret included. The rapidata logger runs at DEBUG and propagates, so the
records reached the telemetry export and the application's own log
handlers.

client_secret is now excluded from the model's repr, and the lookup logs
only the selected credential's display string.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: lino@rapidata.ai <68745352+LinoGiger@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

⚠ Agent skill not updated

This PR does not modify src/rapidata/_skill/. That directory is the agent skill that ships in every SDK release and that coding agents read through python -m rapidata skill.

Before merging, pick one:

  1. The change affects what an agent needs to know (new or renamed API, changed parameter, default or result field, new gotcha): update src/rapidata/_skill/SKILL.md (or a companion guide next to it) in this PR.
  2. Nothing the skill documents changed: a reviewer applies the skill-unchanged-approved label. New commits remove the label again.

This branch has not been deployed

No deployments
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