Skip to content

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

TypeScript

fix(llm-proxy): bound the execution ticket at the envelope allowance

Alfredo Lopeze211de6811a3
diff --git a/codex-llm-proxy/src/server.ts b/codex-llm-proxy/src/server.ts
index 181c8873c..8b9e0ba72 100644
--- a/codex-llm-proxy/src/server.ts
+++ b/codex-llm-proxy/src/server.ts
@@ -79,7 +79,9 @@ const COMPLETION_PATH = '/internal/runtime/v1/codex/completions'
const completionBodySchema = z
.object({
- executionTicket: z.string().min(1),
+ // A signed JWT of a few hundred bytes; the bound keeps an oversized
+ // string from reaching jwt.verify.
+ executionTicket: z.string().min(1).max(ENVELOPE_ALLOWANCE_BYTES),
requestHash: z.string().regex(/^[a-f0-9]{64}$/),
request: z.object({}).passthrough(),
deadlineMs: z.number().int().positive().optional(),
diff --git a/grok-llm-proxy/src/server.ts b/grok-llm-proxy/src/server.ts
index ef9544a74..e5a77172c 100644
--- a/grok-llm-proxy/src/server.ts
+++ b/grok-llm-proxy/src/server.ts
@@ -83,7 +83,9 @@ const ADMIN_KEYS = new Set(['accessToken'])
const completionBodySchema = z
.object({
- executionTicket: z.string().min(1),
+ // A signed JWT of a few hundred bytes; the bound keeps an oversized
+ // string from reaching jwt.verify.
+ executionTicket: z.string().min(1).max(ENVELOPE_ALLOWANCE_BYTES),
requestHash: z.string().regex(/^[a-f0-9]{64}$/),
request: z.object({}).passthrough(),
deadlineMs: z.number().int().positive().optional(),
diff --git a/grok-llm-proxy/test/server.security.test.ts b/grok-llm-proxy/test/server.security.test.ts
index 44f1ae4f9..e32261b98 100644
--- a/grok-llm-proxy/test/server.security.test.ts
+++ b/grok-llm-proxy/test/server.security.test.ts
@@ -240,6 +240,7 @@ describe('grok-llm-proxy security surface', () => {
.send(payload)
expect(admin.status).toBe(413)
expect(visualStreamGate.snapshot()).toEqual({ running: 0, queued: 0 })
+ acquire.mockRestore()
}, 30_000)
// r10 Y1: the ticket is a signed JWT of a few hundred bytes. The non-image