xonecas.io
64875
Mc

mini-coder / commit 501f874

feat: redact authorization headers in API logs and update deps

- Add redactHeaders utility to mask sensitive headers before logging
- Remove claude-code-20250219 beta flag from Anthropic provider
- Bump yoctomarkdown to ^0.0.6

xonecas2026-03-16 501f874e8312a83e95276e5a6928bee1f03a0551 parent 36b0220

2 files changed

package.json+1−1
@@ -28,7 +28,7 @@
2828 "ai": "^6.0.127",
2929 "diff": "^8.0.3",
3030 "yoctocolors": "^2.1.2",
31- "yoctomarkdown": "^0.0.5",
31+ "yoctomarkdown": "^0.0.6",
3232 "zod": "^4.3.6"
3333 },
3434 "devDependencies": {
src/llm-api/providers.ts+17−3
@@ -34,6 +34,20 @@ type GoogleProvider = ReturnType<typeof createGoogleGenerativeAI>;
3434 type OpenAICompatProvider = ReturnType<typeof createOpenAICompatible>;
3535 type ModelResolver = (modelId: string) => LanguageModel;
3636
37+const REDACTED_HEADERS = new Set(["authorization"]);
38+
39+function redactHeaders(
40+ headers: RequestInit["headers"],
41+): Record<string, string> | undefined {
42+ if (!headers) return undefined;
43+ const h = new Headers(headers as ConstructorParameters<typeof Headers>[0]);
44+ const out: Record<string, string> = {};
45+ h.forEach((v, k) => {
46+ out[k] = REDACTED_HEADERS.has(k) ? "[REDACTED]" : v;
47+ });
48+ return out;
49+}
50+
3751 function createFetchWithLogging(): ProviderFetch {
3852 const customFetch = async (
3953 input: Parameters<ProviderFetch>[0],
@@ -46,14 +60,14 @@ function createFetchWithLogging(): ProviderFetch {
4660 logApiEvent("Provider Request", {
4761 url: input.toString(),
4862 method: init.method,
49- headers: init.headers,
63+ headers: redactHeaders(init.headers),
5064 body: bodyJson,
5165 });
5266 } catch {
5367 logApiEvent("Provider Request", {
5468 url: input.toString(),
5569 method: init.method,
56- headers: init.headers,
70+ headers: redactHeaders(init.headers),
5771 body: init.body,
5872 });
5973 }
@@ -190,7 +204,7 @@ async function resolveAnthropicModel(modelId: string): Promise<LanguageModel> {
190204 fetch: fetchWithLogging,
191205 authToken: token,
192206 headers: {
193- "anthropic-beta": "claude-code-20250219,oauth-2025-04-20",
207+ "anthropic-beta": "oauth-2025-04-20",
194208 },
195209 }),
196210 };