Redact auth tokens from app-server response logs (#39141)

## Why

App-server response diagnostics can include access tokens returned by the ChatGPT auth refresh flow.

## What changed

- Log successfully parsed server responses instead of raw JSON-RPC response payloads.
- Redact `access_token` from the `Debug` representation of `ChatgptAuthTokensRefreshResponse`.
- Avoid formatting callback send errors that can retain the original response payload.

GitOrigin-RevId: fd47485b38ed89527b25937c759b3273581f6ae6
This commit is contained in:
Adam Perry @ OpenAI authored and copyberry committed 2026-08-18 05:25:22 +00:00
1 parent 5ee6baee2f
commit 9a254ba1fa
3 files changed
+20 -9

No files matched your search

@@ -13,6 +13,7 @@ use codex_protocol::protocol::SpendControlLimitSnapshot as CoreSpendControlLimit
use serde::Deserialize;
use serde::Serialize;
use std::collections::HashMap;
use std::fmt;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(tag = "type", rename_all = "camelCase")]
@@ -277,7 +278,7 @@ pub struct ChatgptAuthTokensRefreshParams {
pub previous_account_id: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ChatgptAuthTokensRefreshResponse {
@@ -286,6 +287,16 @@ pub struct ChatgptAuthTokensRefreshResponse {
pub chatgpt_plan_type: Option<String>,
}
impl fmt::Debug for ChatgptAuthTokensRefreshResponse {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ChatgptAuthTokensRefreshResponse")
.field("access_token", &"<redacted>")
.field("chatgpt_account_id", &self.chatgpt_account_id)
.field("chatgpt_plan_type", &self.chatgpt_plan_type)
.finish()
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]