Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-api): use invalid_request for the unreachable null-key guard (R1-L4)
Diego Zacariasb6a937a72513
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 6af284eaa..2079c1c08 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.510",+ "version": "0.1.511","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.510",+ "version": "0.1.511","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/image-policy": "file:../packages/image-policy",diff --git a/control-api/package.json b/control-api/package.jsonindex 60fc209af..e241fe6e3 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.510",+ "version": "0.1.511","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/src/routes/internal/oauth.ts b/control-api/src/routes/internal/oauth.tsindex 9be233e67..42f3b9915 100644--- a/control-api/src/routes/internal/oauth.ts+++ b/control-api/src/routes/internal/oauth.ts@@ -363,7 +363,14 @@ export function createInternalOAuthRouter(gateway: K8sGateway): Router {userId,})if (!key) {- return res.status(400).json({ error: 'server_missing_context' })+ // Unreachable: `buildMcpServerGrantKey` returns null only when a+ // context server lacks `contextRef` (already rejected above at the+ // membership gate) or a user server lacks `userId` (validated+ // non-empty above). Fail closed defensively rather than delete against+ // a malformed key — with the generic `invalid_request` (mirrors the+ // token mint's null-key guard, routes/mcpOauth.ts), since the specific+ // null cause was already handled.+ return res.status(400).json({ error: 'invalid_request' })}const deletedRows = await deleteOAuthGrant(