diff --git a/request-logger/render.test.ts b/request-logger/render.test.ts index da83a5c..1844b65 100644 --- a/request-logger/render.test.ts +++ b/request-logger/render.test.ts @@ -359,4 +359,18 @@ describe("renderMarkdown header redaction", () => { expect(out).not.toContain("secret-token"); expect(out).toContain("[REDACTED]"); }); + + it("hides the x-goog-api-key header", () => { + const out = renderMarkdown({ + ...BASE, + agent: "Gemini CLI", + renderer: "gemini", + headers: { "x-goog-api-key": "secret-goog-key" }, + path: "/v1beta/models/gemini-2.5-pro:generateContent", + requestBody: body(GEMINI_REQUEST), + responseRaw: "", + }); + expect(out).not.toContain("secret-goog-key"); + expect(out).toContain("[REDACTED]"); + }); }); diff --git a/request-logger/render.ts b/request-logger/render.ts index bcba576..14871d1 100644 --- a/request-logger/render.ts +++ b/request-logger/render.ts @@ -34,7 +34,12 @@ interface RenderInput { responseRaw: string; } -const REDACT = new Set(["authorization", "x-api-key", "api-key"]); +const REDACT = new Set([ + "authorization", + "x-api-key", + "api-key", + "x-goog-api-key", +]); /** * Turn the raw request bytes into text.