Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(guardrails): keep mcp-host except empty; kustomize fills it (n12)
Andy Paviadd22838d7689
diff --git a/deploy/base/mcp-host/networkpolicies.yaml b/deploy/base/mcp-host/networkpolicies.yamlindex 26d74c953..c3bf4c687 100644--- a/deploy/base/mcp-host/networkpolicies.yaml+++ b/deploy/base/mcp-host/networkpolicies.yaml@@ -110,29 +110,11 @@ spec:to:- ipBlock:cidr: 0.0.0.0/0- # Public-internet only (N12): exclude cluster pod/service/node CIDRs and- # all private/link-local/metadata/reserved ranges — the SAME list HCC- # applies to mcp-server public-web egress (PUBLIC_EGRESS_EXCEPT_CIDRS).- # Internal deps ride separate dedicated lanes above, so this is safe.- except:- - 0.0.0.0/8- - 10.0.0.0/8- - 100.64.0.0/10- - 127.0.0.0/8- - 169.254.0.0/16- - 172.16.0.0/12- - 192.0.0.0/24- - 192.0.2.0/24- - 192.31.196.0/24- - 192.52.193.0/24- - 192.88.99.0/24- - 192.168.0.0/16- - 192.175.48.0/24- - 198.18.0.0/15- - 198.51.100.0/24- - 203.0.113.0/24- - 224.0.0.0/4- - 240.0.0.0/4+ # N12: filled at deploy time by the kustomize `replacements` in+ # deploy/base/kustomization.yaml from the canonical PublicEgressExceptionSet+ # (deploy/base/public-egress-exceptions.yaml) — single source of truth,+ # shared with mcp-server public-web egress. Keep empty here.+ except: []# http_request tool: external HTTP with the same public-only boundary.- ports:- port: 80@@ -140,29 +122,11 @@ spec:to:- ipBlock:cidr: 0.0.0.0/0- # Public-internet only (N12): exclude cluster pod/service/node CIDRs and- # all private/link-local/metadata/reserved ranges — the SAME list HCC- # applies to mcp-server public-web egress (PUBLIC_EGRESS_EXCEPT_CIDRS).- # Internal deps ride separate dedicated lanes above, so this is safe.- except:- - 0.0.0.0/8- - 10.0.0.0/8- - 100.64.0.0/10- - 127.0.0.0/8- - 169.254.0.0/16- - 172.16.0.0/12- - 192.0.0.0/24- - 192.0.2.0/24- - 192.31.196.0/24- - 192.52.193.0/24- - 192.88.99.0/24- - 192.168.0.0/16- - 192.175.48.0/24- - 198.18.0.0/15- - 198.51.100.0/24- - 203.0.113.0/24- - 224.0.0.0/4- - 240.0.0.0/4+ # N12: filled at deploy time by the kustomize `replacements` in+ # deploy/base/kustomization.yaml from the canonical PublicEgressExceptionSet+ # (deploy/base/public-egress-exceptions.yaml) — single source of truth,+ # shared with mcp-server public-web egress. Keep empty here.+ except: []---# ─── L1: K8s API server egress (HCC-managed mcp-host pods) ────────────────────# Required for getHost() and other K8s API calls in production mode.diff --git a/docs/features/mcp-host-guardrails/mcp-host-guardrails-spec-v3.md b/docs/features/mcp-host-guardrails/mcp-host-guardrails-spec-v3.mdindex 1ec92b398..3a0e23d73 100644--- a/docs/features/mcp-host-guardrails/mcp-host-guardrails-spec-v3.md+++ b/docs/features/mcp-host-guardrails/mcp-host-guardrails-spec-v3.md@@ -1216,7 +1216,7 @@ controller-generated NetworkPolicy on top of a deny-everything baseline. All inv| N9 | **Secret isolation** | A hook's `envSecret` is resolved only within `llm-hooks` and can never name the mcp-host LLM key or any Host secret. Because hooks and their secrets are confined to their own namespace under scoped RBAC, one hook cannot read another hook's — or the platform's — credentials. Secret material never crosses the namespace boundary into a hook. | Enforced || N10 | **Runtime can't widen its own reach** | The per-Host mcp-host ServiceAccount may **read** (`get`/`list`/`watch`) `LlmHook` CRs only within its own **tenant-scoped** `llm-hooks` namespace — so it sees only its tenant's hooks (multi-tenant uses a per-tenant namespace prefix; cross-tenant isolation comes from that namespace boundary, not from withholding read) — and has **no write** verbs, so it cannot mutate any `Host`/`LlmHook` CR or touch any NetworkPolicy. A compromised mcp-host pod therefore cannot rewrite guardrail policy or open new network paths for itself; policy authorship stays entirely in the trusted control plane (control-api / HCC). | Enforced || N11 | **Fail-closed provisioning** | If HCC cannot build a correct scoped policy for a hook — e.g. the referenced Service has no selector, or a reference can't be resolved — it declines to create an over-broad allow and leaves the hook unreachable under the default-deny baseline. Reachability only appears when a precise allow is successfully provisioned; a provisioning failure fails **closed**, not open. (The separate hook-resolution fail-posture at load time is still open — see §12.4.) | Enforced |-| N12 | **No internal reach via broad egress** | The broad *external* egress lanes — mcp-host's `0.0.0.0/0:443\|80` LLM / `http_request` lane, and each hook's `egressBindings` — exclude the cluster pod/service/node CIDRs and all private/link-local/metadata/reserved ranges, so neither mcp-host nor a hook can reach a cluster-internal or metadata IP through them. Enforced by `ipBlock.except` on the mcp-host lane (the network mirror of the app-layer `isPrivateIp` guard, §8.3) and by `isAllowedExternalEgressCidr` validation of hook `egressBindings` at reconcile. Cluster-internal destinations stay reachable only through the narrow, explicit per-destination lanes. **NOTE:** the mcp-host `except` must be emitted by HCC's `networkPolicyReconciler` (which generates that lane) — NOT the base manifest, which HCC overwrites and which clobbers the HCC-managed API-egress NP. | hook `egressBindings` Enforced; mcp-host `except` pending HCC |+| N12 | **No internal reach via broad egress** | The broad *external* egress lanes — mcp-host's `0.0.0.0/0:443\|80` LLM / `http_request` lane, and each hook's `egressBindings` — exclude the cluster pod/service/node CIDRs and all private/link-local/metadata/reserved ranges, so neither mcp-host nor a hook can reach a cluster-internal or metadata IP through them. Enforced by `ipBlock.except` on the mcp-host lane (the network mirror of the app-layer `isPrivateIp` guard, §8.3) and by `isAllowedExternalEgressCidr` validation of hook `egressBindings` at reconcile. Cluster-internal destinations stay reachable only through the narrow, explicit per-destination lanes. **Ops:** the mcp-host `except` is **filled by kustomize `replacements`** (`deploy/base/kustomization.yaml`) from the canonical `PublicEgressExceptionSet` (`deploy/base/public-egress-exceptions.yaml`) — the same source used for mcp-server public-web egress and `PUBLIC_EGRESS_EXCEPT_CIDRS`; the base NP keeps `except: []`. A raw (non-kustomize) base apply leaves it empty, which is why the dev cluster needed a live patch. | Enforced |---