Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(control-api): always verify the authorize limiter JWT

Alfredo Lopezc5f206cf90b8
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 7f6ce4328..343c05cc9 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.595",
+ "version": "0.1.596",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.595",
+ "version": "0.1.596",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",
diff --git a/control-api/package.json b/control-api/package.json
index 860e1b21b..15acddefd 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.595",
+ "version": "0.1.596",
"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/workflows/shared/rateLimit.ts b/control-api/src/routes/workflows/shared/rateLimit.ts
index d00203a8c..c595a2151 100644
--- a/control-api/src/routes/workflows/shared/rateLimit.ts
+++ b/control-api/src/routes/workflows/shared/rateLimit.ts
@@ -203,11 +203,11 @@ export function codexOAuthCallbackRateLimits() {
export function mcpHostAttemptRateLimitKey(req: Request): string {
const attached = req.mcpHostJwt
if (attached?.sub) return `llm_provider_attempt:${attached.sub}`
- const bearer = extractBearerToken(req)
- if (bearer) {
- const verified = verifyMcpHostAccessJwt(bearer)
- if (verified?.sub) return `llm_provider_attempt:${verified.sub}`
- }
+ // Always verify. Gating on bearer truthiness is a user-controlled skip of
+ // the security check (CodeQL js/user-controlled-bypass). Empty or forged
+ // tokens return null and share the IP bucket.
+ const verified = verifyMcpHostAccessJwt(extractBearerToken(req))
+ if (verified?.sub) return `llm_provider_attempt:${verified.sub}`
return `llm_provider_attempt:ip:${ipKeyGenerator(req.ip ?? 'unknown')}`
}