Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-api): close mutation gap in the self-hosted allowlist gate + comment/test hygiene
Jose Ramireza3a7688b8d6f
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex f84aba000..69c1f165e 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.382",+ "version": "0.1.383","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.382",+ "version": "0.1.383","dependencies": {"@clerum/image-policy": "file:../packages/image-policy","@clerum/llm-providers": "file:../packages/llm-providers",diff --git a/control-api/package.json b/control-api/package.jsonindex 3b3990254..1b269f887 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.382",+ "version": "0.1.383","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/src/config.ts b/control-api/src/config.tsindex a159e179d..d0abfb6f6 100644--- a/control-api/src/config.ts+++ b/control-api/src/config.ts@@ -833,9 +833,12 @@ if (config.registryAuthEnabled && config.registryUrl === '') {// this list. `example.com` is the reserved-domain fixture used across the// test suite — inert (no real registry) and kept so tests need no churn.//-// Reads process.env directly, NOT config.registryConnectionMode: the mode-// PARSER defaults to 'managed' when unset, so gating on the parsed value would-// newly break managed deployments that rely on that default.+// The gate must never be `config.registryUrl !== ''` alone — dropping the+// self-hosted disjunct is exactly the rejected design that broke managed mode+// (see the regression test below). Reading process.env directly here is+// defensive against a future change to the parser's default; for today's+// parser it is equivalent to config.registryConnectionMode, not itself+// load-bearing.if (config.registryUrl !== '' &&(process.env.REGISTRY_CONNECTION_MODE === 'self-hosted' || config.registryAuthEnabled)diff --git a/control-api/test/app.publisherUiEnabled.test.ts b/control-api/test/app.publisherUiEnabled.test.tsindex e2f204b5e..7d2f68854 100644--- a/control-api/test/app.publisherUiEnabled.test.ts+++ b/control-api/test/app.publisherUiEnabled.test.ts@@ -48,6 +48,7 @@ describe('GET /admin/registry/publish-scope: publisherUiEnabled (effective, throprocess.env = { ...ORIGINAL_ENV }delete process.env.CONTROL_API_PUBLISHER_UI_ENABLEDdelete process.env.REGISTRY_CONNECTION_MODE+ delete process.env.CLERUM_REGISTRY_URLregistryClient.resolvePublishScope.mockReset()registryClient.resolvePublishScope.mockResolvedValue({curator: false,diff --git a/control-api/test/config.publisherUiEnabled.test.ts b/control-api/test/config.publisherUiEnabled.test.tsindex fa993f45d..6f1ff2f6d 100644--- a/control-api/test/config.publisherUiEnabled.test.ts+++ b/control-api/test/config.publisherUiEnabled.test.ts@@ -7,6 +7,7 @@ beforeEach(() => {process.env = { ...ORIGINAL_ENV }delete process.env.CONTROL_API_PUBLISHER_UI_ENABLEDdelete process.env.REGISTRY_CONNECTION_MODE+ delete process.env.CLERUM_REGISTRY_URL})afterEach(() => {process.env = ORIGINAL_ENVdiff --git a/control-api/test/config.registryConnectionMode.test.ts b/control-api/test/config.registryConnectionMode.test.tsindex 92bb0847e..c6173a189 100644--- a/control-api/test/config.registryConnectionMode.test.ts+++ b/control-api/test/config.registryConnectionMode.test.ts@@ -133,6 +133,20 @@ describe('boot validation — URL allowlist re-gating', () => {await expect(import('../src/config.js')).resolves.toBeDefined()})+ // The mutation-killer: the previous test's URL happens to be on the+ // hardcoded allowlist, so it cannot distinguish the correct gate from the+ // rejected `config.registryUrl !== ''` alone (which would run the allowlist+ // here too and still pass by coincidence). An UNLISTED URL is required to+ // prove the self-hosted disjunct — not just the auth disjunct — is what+ // keeps this case from running the allowlist at all.+ it('managed-by-default + UNLISTED url + auth off still boots', { retry: 0 }, async () => {+ vi.resetModules()+ delete process.env.REGISTRY_CONNECTION_MODE+ process.env.CLERUM_REGISTRY_AUTH_ENABLED = 'false'+ process.env.CLERUM_REGISTRY_URL = 'https://not-on-the-list.example.net'+ await expect(import('../src/config.js')).resolves.toBeDefined()+ })+// The new explicit check. Today an empty URL with auth on throws via the// allowlist (allowed.includes('') is never true). The new allowlist block is// preconditioned on registryUrl !== '', which would skip it — so this needs