safe_json_serialize 将 AuthCredential 秘密字段转换为 span 属性; MCP 头部已进行修剪,这些信息不可见
Required Information
Describe the Bug:
google.adk.telemetry._serialization.safe_json_serialize serializes pydantic models with model_dump(mode="json"), which renders every field — including those declared as Field(repr=False) by AuthCredential, OAuth2Auth, HttpCredentials and ServiceAccountCredential.
adk_request_credential carries an AuthConfig as its arguments (AuthToolArguments.auth_config) and receives one back as its function response, and AuthConfig.exchanged_auth_credential is a full AuthCredential. So the tool-call span for that flow exports the OAuth access_token, refresh_token and client_secret in the clear, in GCP.vertex.agent.tool_call_args and GCP.vertex.agent.tool_response.
This is the default configuration, not an opt-in: ADK_CAPTURE_MESSAGE_CONTENT_IN_SPANS defaults on TelemetryContext.should_add_content_to_legacy_spans. The spans go wherever the exporter points — Cloud Trace, or any third-party OTel backend.
内容来源: google/adk-python