Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(e2e): validate original proxy image before fixture creation
Alfredo Lopez88285647bf63
diff --git a/scripts/e2e/prepare-codex-approved-tools.mjs b/scripts/e2e/prepare-codex-approved-tools.mjsindex aca04c270..a6e2149ec 100644--- a/scripts/e2e/prepare-codex-approved-tools.mjs+++ b/scripts/e2e/prepare-codex-approved-tools.mjs@@ -399,6 +399,16 @@ export function validateOwnerArgs(args, recording, profile, pidDirectory) {return args}+export function validateProxyImage(image, imagePullPolicy) {+ if (+ !/^(clerum\/codex-(llm-proxy|approved-tools-proxy-e2e)|ghcr\.io\/evenfire-ai\/codex-llm-proxy)(:[a-zA-Z0-9._-]+|@sha256:[a-f0-9]{64})$/.test(+ image+ ) ||+ !['Always', 'IfNotPresent', 'Never'].includes(imagePullPolicy)+ )+ throw new Error('Invalid proxy image')+}+export function validateKubectlArgs(args, profile, { input, resourceCleanup } = {}) {if (args[0] !== `--context=${validateProfile(profile)}` || args[1] !== '--request-timeout=30s')throw new Error('Invalid kubectl context or timeout')@@ -471,14 +481,8 @@ export function validateKubectlArgs(args, profile, { input, resourceCleanup } =const entries = patch?.spec?.template?.spec?.containersif (!Array.isArray(entries) || entries.length !== 1) throw new Error('Invalid proxy patch')const c = entries[0]- if (- c.name !== 'codex-llm-proxy' ||- !/^(clerum\/codex-(llm-proxy|approved-tools-proxy-e2e)|ghcr\.io\/evenfire-ai\/codex-llm-proxy)(:[a-zA-Z0-9._-]+|@sha256:[a-f0-9]{64})$/.test(- c.image- ) ||- !['Always', 'IfNotPresent', 'Never'].includes(c.imagePullPolicy)- )- throw new Error('Invalid proxy image')+ if (c.name !== 'codex-llm-proxy') throw new Error('Invalid proxy image')+ validateProxyImage(c.image, c.imagePullPolicy)if (!Array.isArray(c.env) ||c.env.length !== 3 ||@@ -1076,6 +1080,8 @@ async function main() {const originalNodeEnv = container.env?.find(e => e.name === 'NODE_ENV')if (originalNodeEnv && !['production', 'development', 'test'].includes(originalNodeEnv.value))throw new Error('Unsupported explicit NODE_ENV binding')+ // Refuse an unsupported original image before any fixture resource is created.+ validateProxyImage(container.image, container.imagePullPolicy)state = {profile,worktree: repo,diff --git a/scripts/e2e/prepare-codex-approved-tools.test.mjs b/scripts/e2e/prepare-codex-approved-tools.test.mjsindex 87d83c8db..98d7b00d9 100644--- a/scripts/e2e/prepare-codex-approved-tools.test.mjs+++ b/scripts/e2e/prepare-codex-approved-tools.test.mjs@@ -23,9 +23,24 @@ import {validateKubectlArgs,validateOwnerArgs,validateProfile,+ validateProxyImage,validateRunDirectory,} from './prepare-codex-approved-tools.mjs'+test('original proxy image must satisfy the same policy used for restoration', () => {+ for (const image of [+ 'clerum/codex-llm-proxy:test',+ `ghcr.io/evenfire-ai/codex-llm-proxy@sha256:${'a'.repeat(64)}`,+ ])+ assert.doesNotThrow(() => validateProxyImage(image, 'IfNotPresent'))+ for (const image of ['localhost:5000/proxy:test', 'unrelated/proxy:test', ''])+ assert.throws(() => validateProxyImage(image, 'Never'), /Invalid proxy image/)+ assert.throws(+ () => validateProxyImage('clerum/codex-llm-proxy:test', 'invalid'),+ /Invalid proxy image/+ )+})+const scenarios = makeScenarios('approved-tools-a1b2c3d4e5f6', [43101, 43102, 43103], 43104)test('explicit tools fixtures never enter default publish, acquisition or verification sets', () => {