Skip to content

fix(auth): redact non-OAuth credential secrets from the auth request event - #6993

Open
herdiyana256 wants to merge 1 commit into
google:mainfrom
herdiyana256:redact-nonoauth-secrets-in-auth-request
Open

fix(auth): redact non-OAuth credential secrets from the auth request event#6993
herdiyana256 wants to merge 1 commit into
google:mainfrom
herdiyana256:redact-nonoauth-secrets-in-auth-request

Conversation

@herdiyana256

Copy link
Copy Markdown
Contributor

The adk_request_credential event is streamed to the client and appended to the session, so the redaction applied before it goes out has to cover every secret the credential can carry. _credential_without_client_secret in auth/auth_handler.py only nulled oauth2.client_secret, and _generate_auth_request returns the auth config unchanged for any non-OAuth scheme, so an api_key, an HTTP Basic password, or a service account private_key reached the client verbatim through generate_auth_request and flows/llm_flows/functions.py:build_auth_request_event, and stayed readable in the session. The workflow human-in-the-loop path had the same oauth2-only gap in its own _without_client_secret helper.

This is the same class the A2A relay path already handles by dropping the whole credential-bearing part (agents/remote_a2a_agent.py), whose comment notes the arguments carry "an OAuth2 client secret or a service account key". The direct-to-client and workflow paths keep the non-secret fields the client legitimately needs (scheme, client_id, generated auth_uri, state) and strip the secrets instead of the whole part.

This change nulls api_key, http.credentials.password, and the service account private_key alongside oauth2.client_secret on both helpers. A normal OAuth2 request keeps its client_id and generated auth_uri and only loses client_secret, so the consent flow is unchanged. Adds unit tests for the API-key and service-account cases and updates the existing non-OAuth test that had asserted the full credential was returned.

…th2 client secret

The adk_request_credential event is streamed to the client and stored in the
session, so the redaction applied before sending it must cover every secret the
credential can carry. _credential_without_client_secret nulled only
oauth2.client_secret, so for a non-OAuth scheme an api_key, an HTTP Basic
password, or a service account private key reached the client verbatim through
generate_auth_request and build_auth_request_event. The workflow
human-in-the-loop path had the same oauth2-only gap in its own helper.

Null api_key, http.credentials.password and the service account private_key
alongside oauth2.client_secret on both paths. A normal OAuth2 request keeps its
client_id and generated auth_uri and only loses client_secret.
@herdiyana256
herdiyana256 force-pushed the redact-nonoauth-secrets-in-auth-request branch from 4b0e988 to 132ae57 Compare September 2, 2026 18:31
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