Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-api): gate the Host model allowlist on name key presence
Jose Gabriel Ramirez Encinas66a6c07423fb
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 08289b3e8..c39cbd285 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.578",+ "version": "0.1.579","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.578",+ "version": "0.1.579","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 90f6258e2..794acfe67 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.578",+ "version": "0.1.579","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/admin/hostSpecValidation.ts b/control-api/src/routes/admin/hostSpecValidation.tsindex cfac73eca..523c4f89d 100644--- a/control-api/src/routes/admin/hostSpecValidation.ts+++ b/control-api/src/routes/admin/hostSpecValidation.ts@@ -494,7 +494,7 @@ export async function validateHostSpec(// gate — that is strictly fail-closed. A spec with no `name` key at all is left// untouched (deployed Hosts are never disrupted).const model = spec.model- if (isPlainObject(model) && model.name !== undefined) {+ if (isPlainObject(model) && Object.prototype.hasOwnProperty.call(model, 'name')) {const name = typeof model.name === 'string' ? model.name.trim() : ''if (!name) {return {diff --git a/control-api/test/routes.hostSpecValidation.test.ts b/control-api/test/routes.hostSpecValidation.test.tsindex e8b3de874..b915ed9b5 100644--- a/control-api/test/routes.hostSpecValidation.test.ts+++ b/control-api/test/routes.hostSpecValidation.test.ts@@ -51,6 +51,27 @@ describe('validateHostSpec', () => {expect(isModelAllowed).toHaveBeenCalledWith('azure', 'my-gpt-4o-deployment', undefined)})+ it.each([+ ['null', null],+ ['an empty string', ''],+ ['whitespace', ' '],+ ])(+ 'rejects a present spec.model.name that is %s (fail-closed, no lookup)',+ async (_label, name) => {+ const isModelAllowed = vi.fn()+ const res = await validateHostSpec(+ { model: { provider: 'claude', name } },+ { isModelAllowed }+ )+ expect(res).toEqual({+ errors: [+ { field: 'spec.model.name', message: 'spec.model.name must be a non-empty string' },+ ],+ })+ expect(isModelAllowed).not.toHaveBeenCalled()+ }+ )+it('rejects a present-but-non-string spec.model.name (fail-closed, no lookup)', async () => {const isModelAllowed = vi.fn()const res = await validateHostSpec(