Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(llm): close authorize parser bypass and image parity gaps
Alfredo Lopezf8758143740a
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 901ef8fa0..9ddf1f33f 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.701",+ "version": "0.1.702","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.701",+ "version": "0.1.702","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.jsonindex 43026ba2d..535bbc6c5 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.701",+ "version": "0.1.702","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/src/app.ts b/control-api/src/app.tsindex b91791477..86e5c756c 100644--- a/control-api/src/app.ts+++ b/control-api/src/app.ts@@ -78,7 +78,9 @@ export function createApp(gateway: K8sGateway) {})const app = express()app.set('trust proxy', 1)- const jsonBodyParser = express.json({ limit: config.jsonBodyLimit })+ // Reject compressed JSON before inflation: this parser runs before+ // authentication, and a small encoded body can allocate a much larger one.+ const jsonBodyParser = express.json({ limit: config.jsonBodyLimit, inflate: false })const tracingInFlightLimiter = createTracingInFlightLimiter(getTracingMaxInFlight())app.use((req, res, next) => {if (req.method === 'POST' && req.path.startsWith(TRACING_INTERNAL_PATH_PREFIX)) {@@ -93,7 +95,9 @@ export function createApp(gateway: K8sGateway) {next()return}- if (req.method === 'POST' && LLM_AUTHORIZE_PATH.test(req.path)) {+ // Express permits repeated separators at router mount boundaries. Match+ // the exemption on the normalized path without changing request routing.+ if (req.method === 'POST' && LLM_AUTHORIZE_PATH.test(req.path.replace(/\/+/g, '/'))) {next()return}diff --git a/control-api/src/services/llmProviderAttemptAuthorizer.ts b/control-api/src/services/llmProviderAttemptAuthorizer.tsindex a2f29e3bd..6a7751e7c 100644--- a/control-api/src/services/llmProviderAttemptAuthorizer.ts+++ b/control-api/src/services/llmProviderAttemptAuthorizer.ts@@ -158,6 +158,11 @@ const defaultDeps = (): LlmProviderAttemptAuthorizerDeps => ({export { computeCodexPolicyHash }+// body > request > messages[] > message > toolCalls[] > call > arguments: the+// deepest free-form tree the contracts accept sits six containers below the+// body root, and may itself nest maxNestingDepth containers.+const MAX_AUTHORIZE_BODY_DEPTH = Math.max(LIMITS.maxNestingDepth, GROK_LIMITS.maxNestingDepth) + 6+/*** #731 — room for the authorize envelope around the contract-capped `request`:* ids, revisions, hashes and recipe names, a few hundred bytes in practice.@@ -171,6 +176,28 @@ export { computeCodexPolicyHash }*/export const AUTHORIZE_ENVELOPE_ALLOWANCE_BYTES = ENVELOPE_ALLOWANCE_BYTES+/**+ * Reject an over-deep body before anything serializes it, including direct+ * service calls that do not pass through the route's raw-body scan. Iterative,+ * so attacker-controlled nesting cannot turn a refusal into a RangeError/500.+ */+function assertBodyNestingWithinLimit(body: Record<string, unknown>): void {+ const stack: Array<[unknown, number]> = [[body, 1]]+ while (stack.length > 0) {+ const [node, depth] = stack.pop()!+ if (depth > MAX_AUTHORIZE_BODY_DEPTH) {+ throw new LlmProviderAttemptAuthorizeError(+ 'invalid_request',+ 'request body exceeds the maximum nesting depth'+ )+ }+ const children = Array.isArray(node) ? node : Object.values(node as Record<string, unknown>)+ for (const child of children) {+ if (child !== null && typeof child === 'object') stack.push([child, depth + 1])+ }+ }+}+function firstUnknownKey(body: Record<string, unknown>): string | null {for (const key of Object.keys(body)) {if (!AUTHORIZE_BODY_KEYS.has(key)) return key@@ -250,8 +277,7 @@ async function authorizeGrokProviderAttempt('mcp-host JWT lacks the llm:grok:execute scope')}- // The route's raw-body scan bounds nesting depth before parsing, so- // JSON.stringify cannot overflow the stack here.+ assertBodyNestingWithinLimit(body)const serialized = JSON.stringify(body)// Same budgets as the Codex path (#784): the larger of the non-image cap plus// the envelope allowance and the V2 visual envelope bounds the whole body;@@ -657,8 +683,7 @@ export async function authorizeLlmProviderAttempt('mcp-host JWT lacks the llm:codex:execute scope')}- // The route's raw-body scan bounds nesting depth before parsing, so- // JSON.stringify cannot overflow the stack here.+ assertBodyNestingWithinLimit(body)const serialized = JSON.stringify(body)// The larger of the two budgets wins, as on the gateway's client_max_body_size:// the non-image cap plus the envelope allowance (#731), or the V2 visualdiff --git a/control-api/test/routes.mcp-host.llmProviderAttempts.createApp.test.ts b/control-api/test/routes.mcp-host.llmProviderAttempts.createApp.test.tsindex 8228470e7..e9e4fefba 100644--- a/control-api/test/routes.mcp-host.llmProviderAttempts.createApp.test.ts+++ b/control-api/test/routes.mcp-host.llmProviderAttempts.createApp.test.ts@@ -1,6 +1,9 @@import { beforeEach, describe, expect, it, vi } from 'vitest'-import { createServer } from 'node:http'+import { createServer, request as httpRequest } from 'node:http'+import { gzipSync } from 'node:zlib'+import { registry } from '../src/observability/metrics.js'import * as authorizer from '../src/services/llmProviderAttemptAuthorizer.js'+import { issueMcpHostAccessJwt } from '../src/utils/auth/mcpHostJwtToken.js'import { MockGateway } from './mockGateway.js'vi.mock('../src/config.js', async importOriginal => {@@ -85,3 +88,222 @@ describe('createApp POST /api/v1/mcp-host/llm/provider-attempts/authorize', () =}}, 30_000)})++const PROVIDERS = [+ {+ provider: 'codex-subscription',+ schemaVersion: 'codex-completion-request.v1',+ model: 'gpt-5.1',+ scope: 'llm:codex:execute',+ },+ {+ provider: 'grok-subscription',+ schemaVersion: 'grok-completion-request.v1',+ model: 'grok-4.6',+ scope: 'llm:grok:execute',+ },+] as const++const AUTHORIZE_PATHS = [+ { name: 'canonical path', path: '/api/v1/mcp-host/llm/provider-attempts/authorize' },+ { name: 'double-slash path', path: '/api/v1//mcp-host/llm/provider-attempts/authorize' },+] as const++type ProviderCase = (typeof PROVIDERS)[number]++function bodyOf(p: ProviderCase, parameters = '{"type":"object"}'): string {+ return (+ `{"request":{"schemaVersion":"${p.schemaVersion}","requestId":"req-1",` ++ `"idempotencyKey":"idem-1","provider":"${p.provider}","model":"${p.model}",` ++ `"messages":[{"role":"user","content":"hi"}],` ++ `"tools":[{"name":"t","description":"d","parameters":${parameters}}]},` ++ `"invocationId":"inv-1","attemptGeneration":1,"policyRevision":1,` ++ `"policyHash":"${'a'.repeat(64)}"}`+ )+}++function headers(p: ProviderCase): Record<string, string> {+ const issued = issueMcpHostAccessJwt('default', 'research-host', ['research-host'], {+ workflowControlScopes: [p.scope],+ })+ return { Authorization: `Bearer ${issued.token}`, 'content-type': 'application/json' }+}++async function withApp(path: string, run: (url: string) => Promise<void>): Promise<void> {+ const { createApp } = await import('../src/app.js')+ const listener = createServer(createApp(new MockGateway() as never)).listen(0)+ try {+ const address = listener.address()+ if (!address || typeof address === 'string') throw new Error('listener has no port')+ await run(`http://127.0.0.1:${address.port}${path}`)+ } finally {+ await new Promise<void>((resolve, reject) =>+ listener.close(err => (err ? reject(err) : resolve()))+ )+ }+}++async function expectAcceptedBody(url: string, p: ProviderCase): Promise<void> {+ // Only the service is mocked: this witness proves that the real app mount,+ // JWT verification and route parser still deliver the provider's body.+ const success = {+ providerAttemptId: 'attempt-1',+ requestHash: 'a'.repeat(64),+ executionTicket: 'test-execution-ticket',+ expiresAt: '2026-01-01T00:00:00.000Z',+ }+ vi.mocked(authorizer.authorizeLlmProviderAttempt).mockResolvedValueOnce(success)+ const response = await fetch(url, { method: 'POST', headers: headers(p), body: bodyOf(p) })+ expect(response.status).toBe(200)+ expect(await response.json()).toEqual(success)+ expect(authorizer.authorizeLlmProviderAttempt).toHaveBeenCalledExactlyOnceWith(+ expect.objectContaining({ workflowControlScopes: [p.scope] }),+ JSON.parse(bodyOf(p)),+ expect.any(Object)+ )+}++describe('createApp authorize parser boundary', () => {+ beforeEach(() => {+ vi.mocked(authorizer.authorizeLlmProviderAttempt).mockReset()+ })++ for (const { name, path } of AUTHORIZE_PATHS) {+ for (const p of PROVIDERS) {+ describe(`${name} ${p.provider}`, () => {+ it('checks JWT before parsing malformed, 100000-deep and gzip bodies', async () => {+ const malformed = '{not json'+ const deep = bodyOf(p, `${'{"n":'.repeat(99_999)}{}${'}'.repeat(99_999)}`)+ const plain = bodyOf(p)+ await withApp(path, async url => {+ const parse = vi.spyOn(JSON, 'parse')+ try {+ for (const input of [+ { body: malformed, encoding: {} },+ { body: deep, encoding: {} },+ { body: new Uint8Array(gzipSync(plain)), encoding: { 'content-encoding': 'gzip' } },+ ]) {+ const response = await fetch(url, {+ method: 'POST',+ headers: { 'content-type': 'application/json', ...input.encoding },+ body: input.body,+ })+ expect(response.status).toBe(401)+ expect(await response.json()).toEqual({ error: 'Unauthorized' })+ }+ const parsedTexts = parse.mock.calls.map(([text]) => text)+ expect(parsedTexts).not.toContain(malformed)+ expect(parsedTexts).not.toContain(deep)+ expect(parsedTexts).not.toContain(plain)+ expect(authorizer.authorizeLlmProviderAttempt).not.toHaveBeenCalled()+ } finally {+ parse.mockRestore()+ }+ })+ })++ it('refuses authenticated over-deep and malformed bodies before authorize and accepts a valid body', async () => {+ const deep = bodyOf(p, `${'{"n":'.repeat(99_999)}{}${'}'.repeat(99_999)}`)+ await withApp(path, async url => {+ const parse = vi.spyOn(JSON, 'parse')+ try {+ for (const body of [deep, '{"request":']) {+ const response = await fetch(url, { method: 'POST', headers: headers(p), body })+ expect(response.status).toBe(400)+ expect(await response.json()).toEqual({ error: 'invalid_request' })+ }+ expect(parse.mock.calls.map(([text]) => text)).not.toContain(deep)+ expect(authorizer.authorizeLlmProviderAttempt).not.toHaveBeenCalled()+ await expectAcceptedBody(url, p)+ } finally {+ parse.mockRestore()+ }+ })+ })++ it('refuses authenticated gzip before authorize and accepts the same uncompressed body', async () => {+ await withApp(path, async url => {+ const response = await fetch(url, {+ method: 'POST',+ headers: { ...headers(p), 'content-encoding': 'gzip' },+ body: new Uint8Array(gzipSync(bodyOf(p))),+ })+ expect(response.status).toBe(415)+ expect(await response.json()).toEqual({ error: 'unsupported_media_type' })+ expect(authorizer.authorizeLlmProviderAttempt).not.toHaveBeenCalled()+ await expectAcceptedBody(url, p)+ })+ })+ })+ }+ }+})++async function getWithJsonBody(+ url: string,+ body: Buffer,+ encoding?: 'gzip'+): Promise<{ status: number; body: string }> {+ // Fetch forbids GET bodies. A native request exercises the existing, public+ // metrics route and the global parser without adding a fixture-only route.+ return new Promise((resolve, reject) => {+ const req = httpRequest(+ url,+ {+ method: 'GET',+ headers: {+ 'content-type': 'application/json',+ 'content-length': body.length,+ ...(encoding ? { 'content-encoding': encoding } : {}),+ },+ },+ res => {+ const status = res.statusCode+ if (status === undefined) {+ res.resume()+ reject(new Error('response has no status'))+ return+ }+ const chunks: string[] = []+ res.setEncoding('utf8')+ res.on('data', (chunk: string) => chunks.push(chunk))+ res.on('error', reject)+ res.on('end', () => resolve({ status, body: chunks.join('') }))+ }+ )+ req.on('error', reject)+ req.setTimeout(2_000, () => req.destroy(new Error('local parser probe timed out')))+ req.end(body)+ })+}++describe('createApp global JSON encoding', () => {+ it('refuses compressed JSON before parsing or the public handler and accepts the same uncompressed body', async () => {+ const plain = JSON.stringify({ probe: 'global-json-parser', pad: 'x'.repeat(1_024) })+ const compressed = gzipSync(plain)+ expect(Buffer.byteLength(plain)).toBeLessThan(2_048)+ expect(compressed.length).toBeLessThan(Buffer.byteLength(plain))+ await withApp('/metrics', async url => {+ const parse = vi.spyOn(JSON, 'parse')+ const metrics = vi.spyOn(registry, 'metrics')+ try {+ const gzip = await getWithJsonBody(url, compressed, 'gzip')+ // The original global parser yielded 200, parsedBody=true and one+ // handler call: this assertion detects actual inflation and dispatch.+ expect({+ status: gzip.status,+ parsedBody: parse.mock.calls.some(([text]) => text === plain),+ handlerCalls: metrics.mock.calls.length,+ }).toEqual({ status: 415, parsedBody: false, handlerCalls: 0 })+ const uncompressed = await getWithJsonBody(url, Buffer.from(plain))+ expect(uncompressed.status).toBe(200)+ expect(uncompressed.body).toContain('# HELP')+ expect(parse.mock.calls.map(([text]) => text)).toContain(plain)+ expect(metrics).toHaveBeenCalledOnce()+ } finally {+ parse.mockRestore()+ metrics.mockRestore()+ }+ })+ })+})diff --git a/control-api/test/routes.mcp-host.llmProviderAttempts.test.ts b/control-api/test/routes.mcp-host.llmProviderAttempts.test.tsindex 1e07fdfa2..d48852964 100644--- a/control-api/test/routes.mcp-host.llmProviderAttempts.test.ts+++ b/control-api/test/routes.mcp-host.llmProviderAttempts.test.ts@@ -677,8 +677,8 @@ describe('authorize raw-body scan before JSON.parse', () => {})it('answers 400 to a 5000-deep and a 150000-deep body without recursion or the authorizer', async () => {- // JSON.stringify overflows the stack on a body this deep, so the scan is- // the only bound: the authorizer no longer checks nesting itself.+ // JSON.stringify overflows the stack on a body this deep. The raw scan+ // refuses it before parsing; the authorizer also guards direct calls.await withRoute(async url => {for (const depth of [5000, 150000]) {const response = await fetch(url, {diff --git a/control-api/test/services.llmProviderAttemptAuthorizer.depth.test.ts b/control-api/test/services.llmProviderAttemptAuthorizer.depth.test.tsindex bcef1cb9b..53c91f506 100644--- a/control-api/test/services.llmProviderAttemptAuthorizer.depth.test.ts+++ b/control-api/test/services.llmProviderAttemptAuthorizer.depth.test.ts@@ -1,15 +1,16 @@import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import { config } from '../src/config.js'import {+ LlmProviderAttemptAuthorizeError,type LlmProviderAttemptAuthorizerDeps,authorizeLlmProviderAttempt,} from '../src/services/llmProviderAttemptAuthorizer.js'import type { McpHostAccessClaims } from '../src/utils/auth/mcpHostJwtToken.js'-// The contracts cap nesting inside the authorizer (64 containers in tool-// parameters and tool-call arguments). The route's raw-body scan bounds the-// whole body at 70 containers before JSON.parse; its end-to-end depth test is-// in routes.mcp-host.llmProviderAttempts.test.ts.+// The contracts cap free-form trees at 64 containers. The authorizer also+// guards the complete body before serialization, including direct service+// calls that never pass through the route's raw-body scan. The deepest accepted+// assistant tool-call arguments sit six containers below the body root.const PROVIDERS = [{@@ -80,6 +81,27 @@ describe('authorizeLlmProviderAttempt contract nesting cap', () => {})for (const p of PROVIDERS) {+ it(`rejects 100000-deep ${p.provider} bodies before serialization and assignment lookup`, async () => {+ const bodies = [+ wireBody(p, nestedObjects(100_000)),+ wireBody(p, '{"type":"object"}', `,"extra":${nestedObjects(100_000)}`),+ ]+ const stringify = vi.spyOn(JSON, 'stringify')+ try {+ for (const body of bodies) {+ const current = deps()+ const attempt = authorizeLlmProviderAttempt(claims(p.scope), body, current)+ await expect(attempt).rejects.toBeInstanceOf(LlmProviderAttemptAuthorizeError)+ await expect(attempt).rejects.toMatchObject({ code: 'invalid_request' })+ await expect(attempt).rejects.toThrow(/maximum nesting depth/)+ expect(stringify).not.toHaveBeenCalledWith(body)+ expect(current.resolveAssignment).not.toHaveBeenCalled()+ }+ } finally {+ stringify.mockRestore()+ }+ })+it(`lets a ${p.provider} request with 64-deep tool parameters past the contract cap`, async () => {const body = wireBody(p, nestedObjects(64))const current = deps()diff --git a/packages/grok-provider-attempt-contract/index.test.cjs b/packages/grok-provider-attempt-contract/index.test.cjsindex 12641086f..7e26f8359 100644--- a/packages/grok-provider-attempt-contract/index.test.cjs+++ b/packages/grok-provider-attempt-contract/index.test.cjs@@ -1552,10 +1552,10 @@ test('parity: identical verdicts across both visualPayload copies, dimension limassert.equal(codexVisualPayload.inspectVisualImage(large).ok, false)})-// Every branch of the copied container readers, one input each. Both copies-// must return the exact expected verdict, so a mutant cannot survive by-// changing the two copies the same way or by changing only one.-test('parity: every container-reader branch returns the same exact verdict in both copies', () => {+// Exact verdicts for the shared container-reader branches represented below.+// Both copies must agree with the golden result, so these reader paths cannot+// drift silently; this corpus is not a claim about future reader branches.+test('parity: shared container-reader branches return the same exact verdict in both copies', () => {const u32 = value => [(value >>> 24) & 255, (value >>> 16) & 255, (value >>> 8) & 255, value & 255]// CRCs are not verified by either reader, so they are zero here.const chunk = (type, data = []) => [...u32(data.length), ...Buffer.from(type, 'latin1'), ...data, 0, 0, 0, 0]@@ -1581,6 +1581,16 @@ test('parity: every container-reader branch returns the same exact verdict in bo['png, well formed', png(validPng), accepted(validPng.length, 3, 2)],['png, zero width', png([...SIG, ...ihdr(0, 2), ...idat, ...iend]), invalid('PNG dimensions must be positive')],['png, zero height', png([...SIG, ...ihdr(3, 0), ...idat, ...iend]), invalid('PNG dimensions must be positive')],+ [+ 'png, 14-byte IHDR',+ png([+ ...SIG,+ ...chunk('IHDR', [...u32(3), ...u32(2), 8, 6, 0, 0, 0, 0]),+ ...idat,+ ...iend,+ ]),+ invalid('PNG first chunk must be a 13-byte IHDR'),+ ],['png, first chunk is not IHDR',png([...SIG, ...idat, ...iend]),@@ -1626,6 +1636,21 @@ test('parity: every container-reader branch returns the same exact verdict in bojpeg([...SOI, 0x00, ...sof(0xc0, 8, 6), ...sos, ...scan, ...EOI]),invalid('JPEG marker framing is malformed'),],+ [+ 'jpeg, legal fill bytes before a marker',+ jpeg([...SOI, 0xff, 0xff, ...sof(0xc0, 8, 6), ...sos, ...scan, ...EOI]),+ accepted(validJpeg.length + 2, 8, 6),+ ],+ [+ 'jpeg, standalone temporary marker',+ jpeg([...SOI, 0xff, 0x01, ...sof(0xc0, 8, 6), ...sos, ...scan, ...EOI]),+ accepted(validJpeg.length + 2, 8, 6),+ ],+ [+ 'jpeg, standalone restart marker 7',+ jpeg([...SOI, 0xff, 0xd7, ...sof(0xc0, 8, 6), ...sos, ...scan, ...EOI]),+ accepted(validJpeg.length + 2, 8, 6),+ ],['jpeg, short segment', jpeg([...SOI, 0xff, 0xe0, 0x00, 0x01, ...EOI]), invalid('JPEG segment is truncated')],['jpeg, short frame header',diff --git a/packages/llm-provider-attempt-contract/index.test.cjs b/packages/llm-provider-attempt-contract/index.test.cjsindex 735099a51..94108c74b 100644--- a/packages/llm-provider-attempt-contract/index.test.cjs+++ b/packages/llm-provider-attempt-contract/index.test.cjs@@ -7,6 +7,7 @@ const path = require('node:path')const test = require('node:test')const zlib = require('node:zlib')const contract = require('./index.cjs')+const visualPayload = require('./visualPayload.cjs')const {declaredHeaderPng,declaredHeaderPngOfSize,@@ -715,6 +716,47 @@ test('v2 fixture png is a real image: real CRCs and an inflatable scanline strea}})+test('visualPayload: marker-fill and IHDR-length edges return exact verdicts', () => {+ const u32 = value => [(value >>> 24) & 255, (value >>> 16) & 255, (value >>> 8) & 255, value & 255]+ // CRCs are zero because this corpus tests container structure, not pixel decoding.+ const chunk = (type, data = []) => [...u32(data.length), ...Buffer.from(type, 'latin1'), ...data, 0, 0, 0, 0]+ const SIG = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]+ const SOI = [0xff, 0xd8]+ const EOI = [0xff, 0xd9]+ const sof = [+ 0xff, 0xc0, 0x00, 0x11, 0x08, 0, 6, 0, 8,+ 0x03, 1, 0x11, 0, 2, 0x11, 0, 3, 0x11, 0,+ ]+ const sos = [0xff, 0xda, 0x00, 0x0c, 0x03, 1, 0, 2, 0x11, 3, 0x11, 0x00, 0x3f, 0x00]+ const jpegWithPrefix = prefix => [...SOI, ...prefix, ...sof, ...sos, 0x12, 0x34, ...EOI]+ const invalid = message => ({ ok: false, code: 'invalid', message })+ const accepted = (bytes, width, height) => ({ ok: true, value: { bytes, width, height } })+ const jpegLength = jpegWithPrefix([]).length+ const corpus = [+ ['legal FF FF fill before a marker', 'image/jpeg', jpegWithPrefix([0xff, 0xff]), accepted(jpegLength + 2, 8, 6)],+ ['standalone temporary marker', 'image/jpeg', jpegWithPrefix([0xff, 0x01]), accepted(jpegLength + 2, 8, 6)],+ ['standalone restart marker 7', 'image/jpeg', jpegWithPrefix([0xff, 0xd7]), accepted(jpegLength + 2, 8, 6)],+ [+ 'malformed 14-byte IHDR',+ 'image/png',+ [+ ...SIG,+ ...chunk('IHDR', [...u32(3), ...u32(2), 8, 6, 0, 0, 0, 0]),+ ...chunk('IDAT', [0x78, 0x9c]),+ ...chunk('IEND'),+ ],+ invalid('PNG first chunk must be a 13-byte IHDR'),+ ],+ ]+ for (const [name, mimeType, bytes, expected] of corpus) {+ assert.deepEqual(+ visualPayload.inspectVisualImage({ mimeType, data: Buffer.from(bytes).toString('base64') }),+ expected,+ name+ )+ }+})+test('dispatcher: v1 rejects contentParts, unknown versions fail closed, one hash serves both', () => {const v1WithParts = { ...VISUAL_FIXTURE.png, schemaVersion: contract.SCHEMA_VERSION }const rejected = contract.parseCodexCompletionRequestV1(v1WithParts)diff --git a/scripts/ci/pinned-vitest-cases/control-api.json b/scripts/ci/pinned-vitest-cases/control-api.jsonindex bb6fc35c7..5e0ee624f 100644--- a/scripts/ci/pinned-vitest-cases/control-api.json+++ b/scripts/ci/pinned-vitest-cases/control-api.json@@ -6,5 +6,65 @@{"suite": "routes.mcp-host.llmProviderAttempts.test.ts","fullName": "authorize raw-body scan before JSON.parse preserves the module logger binding and request correlation on body refusals"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary canonical path codex-subscription checks JWT before parsing malformed, 100000-deep and gzip bodies"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary canonical path codex-subscription refuses authenticated over-deep and malformed bodies before authorize and accepts a valid body"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary canonical path codex-subscription refuses authenticated gzip before authorize and accepts the same uncompressed body"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary canonical path grok-subscription checks JWT before parsing malformed, 100000-deep and gzip bodies"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary canonical path grok-subscription refuses authenticated over-deep and malformed bodies before authorize and accepts a valid body"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary canonical path grok-subscription refuses authenticated gzip before authorize and accepts the same uncompressed body"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary double-slash path codex-subscription checks JWT before parsing malformed, 100000-deep and gzip bodies"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary double-slash path codex-subscription refuses authenticated over-deep and malformed bodies before authorize and accepts a valid body"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary double-slash path codex-subscription refuses authenticated gzip before authorize and accepts the same uncompressed body"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary double-slash path grok-subscription checks JWT before parsing malformed, 100000-deep and gzip bodies"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary double-slash path grok-subscription refuses authenticated over-deep and malformed bodies before authorize and accepts a valid body"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp authorize parser boundary double-slash path grok-subscription refuses authenticated gzip before authorize and accepts the same uncompressed body"+ },+ {+ "suite": "services.llmProviderAttemptAuthorizer.depth.test.ts",+ "fullName": "authorizeLlmProviderAttempt contract nesting cap rejects 100000-deep codex-subscription bodies before serialization and assignment lookup"+ },+ {+ "suite": "services.llmProviderAttemptAuthorizer.depth.test.ts",+ "fullName": "authorizeLlmProviderAttempt contract nesting cap rejects 100000-deep grok-subscription bodies before serialization and assignment lookup"+ },+ {+ "suite": "routes.mcp-host.llmProviderAttempts.createApp.test.ts",+ "fullName": "createApp global JSON encoding refuses compressed JSON before parsing or the public handler and accepts the same uncompressed body"}]