From 8c9a900e88a2c4f47653b1fcc1ad0509d8311059 Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Thu, 30 Oct 2025 06:52:29 +0200 Subject: [PATCH] Update HttpClient to include proxy operations in API key usage logic and enhance request header logging for proxy paths. --- src/core/http.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/http.ts b/src/core/http.ts index 08a14c3..c59b5e1 100644 --- a/src/core/http.ts +++ b/src/core/http.ts @@ -54,13 +54,14 @@ export class HttpClient { private getAuthHeaders(path: string): Record { const headers: Record = {}; - // For database and pubsub operations, ONLY use API key to avoid JWT user context + // For database, pubsub, and proxy operations, ONLY use API key to avoid JWT user context // interfering with namespace-level authorization const isDbOperation = path.includes("/v1/rqlite/"); const isPubSubOperation = path.includes("/v1/pubsub/"); + const isProxyOperation = path.includes("/v1/proxy/"); - if (isDbOperation || isPubSubOperation) { - // For database/pubsub operations: use only API key (preferred for namespace operations) + if (isDbOperation || isPubSubOperation || isProxyOperation) { + // For database/pubsub/proxy operations: use only API key (preferred for namespace operations) if (this.apiKey) { headers["X-API-Key"] = this.apiKey; } else if (this.jwt) { @@ -116,7 +117,8 @@ export class HttpClient { (path.includes("/db/") || path.includes("/query") || path.includes("/auth/") || - path.includes("/pubsub/")) + path.includes("/pubsub/") || + path.includes("/proxy/")) ) { console.log("[HttpClient] Request headers for", path, { hasAuth: !!headers["Authorization"],