Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(hcc): drop llm-hooks from the runtimeNamespaces default (n5)
Andy Pavia62a4f59e416a
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.jsonindex 279d4bdfe..25be4c4da 100644--- a/host-context-controller/package-lock.json+++ b/host-context-controller/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-host-context-controller",- "version": "0.1.174",+ "version": "0.1.175","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-host-context-controller",- "version": "0.1.174",+ "version": "0.1.175","license": "SEE LICENSE IN LICENSE","dependencies": {"@clerum/image-policy": "file:../packages/image-policy",diff --git a/host-context-controller/package.json b/host-context-controller/package.jsonindex 7854ad18d..ae68fe707 100644--- a/host-context-controller/package.json+++ b/host-context-controller/package.json@@ -1,6 +1,6 @@{"name": "clerum-host-context-controller",- "version": "0.1.174",+ "version": "0.1.175","description": "Host Context Controller - provides McpServer CRDs to mcp-host via REST API","main": "dist/main.js","engines": {diff --git a/host-context-controller/src/config.runtimeNamespaces.test.ts b/host-context-controller/src/config.runtimeNamespaces.test.tsnew file mode 100644index 000000000..bd15d5f24--- /dev/null+++ b/host-context-controller/src/config.runtimeNamespaces.test.ts@@ -0,0 +1,56 @@+import { afterEach, describe, expect, it, vi } from 'vitest'++const originalEnv = process.env++async function loadConfig(raw: string | undefined) {+ vi.resetModules()+ process.env = { ...originalEnv }+ if (raw === undefined) {+ delete process.env.CONTEXT_MAPPER_RUNTIME_NAMESPACES+ } else {+ process.env.CONTEXT_MAPPER_RUNTIME_NAMESPACES = raw+ }+ return import('./config')+}++afterEach(() => {+ process.env = originalEnv+ vi.resetModules()+})++describe('CONTEXT_MAPPER_RUNTIME_NAMESPACES', () => {+ it('defaults to the four platform runtime namespaces', async () => {+ const { config } = await loadConfig(undefined)++ expect(config.runtimeNamespaces).toEqual([+ 'mcp-server',+ 'mcp-host',+ 'sandbox-recipes',+ 'rpc-proxy',+ ])+ })++ // N5 regression guard: listing llm-hooks here makes ensureInfrastructurePolicies+ // emit `allow-dns-egress-llm-hooks` with podSelector: {} (namespace-wide DNS)+ // and `allow-hcc-api-egress-llm-hooks` selecting clerum.io/managed-by, which+ // hook pod templates carry. Both reach a pure `/v1` responder that declared no+ // egressBindings, contradicting "no implicit DNS". The llm-hooks baseline is+ // static (deploy/base/llm-hooks/networkpolicies.yaml) precisely so HCC's+ // namespace-wide infra pass never selects those pods.+ it('omits llm-hooks so hook pods get no implicit DNS or HCC-gateway egress (N5)', async () => {+ const { config } = await loadConfig(undefined)++ expect(config.runtimeNamespaces).not.toContain('llm-hooks')+ })++ it('honours an explicit override', async () => {+ const { config } = await loadConfig('mcp-server,sandbox-recipes,rpc-proxy,sandbox-ui')++ expect(config.runtimeNamespaces).toEqual([+ 'mcp-server',+ 'sandbox-recipes',+ 'rpc-proxy',+ 'sandbox-ui',+ ])+ })+})diff --git a/host-context-controller/src/config.ts b/host-context-controller/src/config.tsindex fe72661a6..feb6a811b 100644--- a/host-context-controller/src/config.ts+++ b/host-context-controller/src/config.ts@@ -554,12 +554,19 @@ export const config: Config = {},},- // Runtime namespaces where L0 deny-all + L1 infrastructure policies apply+ // Runtime namespaces where L0 deny-all + L1 infrastructure policies apply.+ //+ // llm-hooks is deliberately NOT listed: this list is a package deal, and its+ // L1 pass grants namespace-wide DNS (`ensureDnsEgress` uses podSelector: {})+ // plus HCC-gateway egress to every pod carrying clerum.io/managed-by — which+ // hook pod templates do. That would hand a pure `/v1` responder the implicit+ // DNS N5 forbids. The llm-hooks baseline is static instead+ // (deploy/base/llm-hooks/networkpolicies.yaml: deny-all ingress + egress),+ // with per-pod-key ingress and scoped CoreDNS emitted by LlmHookReconciler+ // only for hooks that declare egressBindings.runtimeNamespaces: getEnv('CONTEXT_MAPPER_RUNTIME_NAMESPACES',- // llm-hooks is included so ensureDefaultPolicies lays down default-deny +- // infra (DNS/HCC API/K8s API) egress for guardrail hook pods (§5).- 'mcp-server,mcp-host,sandbox-recipes,rpc-proxy,llm-hooks'+ 'mcp-server,mcp-host,sandbox-recipes,rpc-proxy')!.split(','),// DNS infrastructure CIDR for GKE NodeLocal DNSCache / kube-dns. Emptydiff --git a/host-context-controller/src/llmHookReconciler.test.ts b/host-context-controller/src/llmHookReconciler.test.tsindex c6ddefa63..b148814bc 100644--- a/host-context-controller/src/llmHookReconciler.test.ts+++ b/host-context-controller/src/llmHookReconciler.test.ts@@ -32,7 +32,10 @@ vi.mock('./config', () => ({hostNamespace: 'mcp-host',llmHooksNamespace: 'llm-hooks',mcpServerImagePullPolicy: 'IfNotPresent',- runtimeNamespaces: ['mcp-server', 'mcp-host', 'llm-hooks'],+ // Mirrors the real default: llm-hooks is NOT a runtime namespace, so the+ // "no egress (not even DNS)" assertions below hold for the pod, not just+ // for the per-pod-key policy this file inspects (N5).+ runtimeNamespaces: ['mcp-server', 'mcp-host'],minimalInfraNamespaces: [],},}))