P3.8: Audit NetworkPolicy — downstream services must only accept gateway traffic #12

Closed
opened 2026-09-08 03:57:27 +00:00 by rock · 0 comments
Owner

Summary

Identity headers (X-Forwarded-User, X-Auth-Verified) are only trustworthy if downstream cannot receive direct traffic that spoofs them. Audit and fix NetworkPolicies for all services that will consume identity headers.

Services to audit

  • poimen-memory (poimen namespace) — needs ingress policy restricting to api namespace
  • management-service (sqs namespace) — already has NetworkPolicy, verify
  • minio (storage namespace) — has own auth, but verify no bypass
  • reasoning/ornith/embeddings/reranker-predictor (llm-serving) — no auth, must only accept from api namespace

For each service, verify

  1. NetworkPolicy exists with policyTypes: [Ingress]
  2. Ingress from only allows api namespace (and monitoring for scraping)
  3. No wildcard ingress rules
  4. Default deny is in effect (at least one NetworkPolicy selecting those pods)

Current state (from code review)

  • api-gateway NetworkPolicy exists and is comprehensive (egress to all downstreams)
  • llm-serving namespace: NO NetworkPolicy found — any pod in cluster can call inference engines directly
  • sqs namespace: has NetworkPolicy
  • poimen namespace: unknown

Acceptance Criteria

  • Every downstream that consumes X-Forwarded-* headers has ingress NetworkPolicy
  • llm-serving pods only accept traffic from api namespace
  • Verified with kubectl exec from non-api namespace (should timeout/refuse)

Review checklist

  • Monitoring namespace allowed for Prometheus scraping
  • CNPG replication traffic not blocked (pod-to-pod within same namespace)
  • No namespace uses plain name: label (use kubernetes.io/metadata.name)
## Summary Identity headers (X-Forwarded-User, X-Auth-Verified) are only trustworthy if downstream cannot receive direct traffic that spoofs them. Audit and fix NetworkPolicies for all services that will consume identity headers. ## Services to audit - [ ] `poimen-memory` (poimen namespace) — needs ingress policy restricting to `api` namespace - [ ] `management-service` (sqs namespace) — already has NetworkPolicy, verify - [ ] `minio` (storage namespace) — has own auth, but verify no bypass - [ ] `reasoning/ornith/embeddings/reranker-predictor` (llm-serving) — no auth, must only accept from `api` namespace ## For each service, verify 1. NetworkPolicy exists with `policyTypes: [Ingress]` 2. Ingress `from` only allows `api` namespace (and monitoring for scraping) 3. No wildcard ingress rules 4. Default deny is in effect (at least one NetworkPolicy selecting those pods) ## Current state (from code review) - `api-gateway` NetworkPolicy exists and is comprehensive (egress to all downstreams) - `llm-serving` namespace: NO NetworkPolicy found — any pod in cluster can call inference engines directly - `sqs` namespace: has NetworkPolicy - `poimen` namespace: unknown ## Acceptance Criteria - [ ] Every downstream that consumes X-Forwarded-* headers has ingress NetworkPolicy - [ ] llm-serving pods only accept traffic from api namespace - [ ] Verified with `kubectl exec` from non-api namespace (should timeout/refuse) ## Review checklist - [ ] Monitoring namespace allowed for Prometheus scraping - [ ] CNPG replication traffic not blocked (pod-to-pod within same namespace) - [ ] No namespace uses plain `name:` label (use `kubernetes.io/metadata.name`)
rock added this to the Phase 3: OAuth2 Token Exchange & Identity Propagation milestone 2026-09-08 03:57:27 +00:00
rock added the area/downstreampriority/mediumtype/infrastatus/todo labels 2026-09-08 03:57:27 +00:00
rock self-assigned this 2026-09-08 03:57:28 +00:00
rock added this to the (deleted) project 2026-09-08 04:37:14 +00:00
rock closed this issue 2026-09-08 04:45:20 +00:00
Sign in to join this conversation.