Skip to content

Deploy posture: network policy, safer chart defaults, rotation runbook - #47

Merged
blakebauman merged 1 commit into
mainfrom
hardening/deploy-posture
Aug 12, 2026
Merged

blakebauman merged 1 commit into
mainfrom
hardening/deploy-posture

Conversation

@blakebauman

Copy link
Copy Markdown
Member

Phase 4 (final) of the 2026-08-11 production-hardening audit — deploy posture and runbooks. Closes out findings M7–M10 and L4/L8–L12; with this, every high/medium finding from the audit is remediated.

Chart

  • Opt-in networkPolicy template (M7): scopes the MCP port, gives the metrics listener the network scope its documented security model assumes, and — with egress.enabled — bounds where a pod holding every upstream credential may connect (DNS + operator-listed rules). Exercised in ci/full-values.yaml.
  • PDB on by default (M8): docs/deploy.md's checklist already said "PodDisruptionBudget on" while the chart shipped it off with 2 replicas — the exact shape where one node drain takes both pods. Rendered only when replicaCount ≥ 2 (or autoscaling), so single-replica deployments never get their drains blocked. Default soft topology spread across zones and hostnames (ScheduleAnyway — single-node clusters unaffected; setting topologySpreadConstraints replaces the defaults).
  • automountServiceAccountToken: false on the pod spec (L10) — the SA already set it; the pod-level pin covers user-supplied ServiceAccounts.
  • redis.url documented as password-less-only (L11): the plain value lands verbatim in the Deployment manifest.

compose

  • fold, Prometheus, and anonymous-Admin Grafana now bind 127.0.0.1 like Redis already did (M10) — the file's own "do not put this on a network" comment now matches what it does. Publishing deliberately is a one-line override.
  • Images reference the release tag instead of mutable :latest (L9); the release flow bumps it.

Docs & CLI

  • "Rotating credentials" runbook (M9): secrets enter as env vars fixed at process start — hot reload does not re-read them, however tempting SIGHUP looks. Per-credential procedures: upstream keys (overlap-friendly), the EMA signing key (no dual-key overlap — a restart invalidates up-to-10-minute-old minted tokens, clients re-exchange), Redis password (fails open during the window), discovery/webhook tokens, and the one rotation needing nothing: IdP JWKS rollover (absorbed live on unknown kid).
  • Probe semantics for non-Helm deploys (L4): never use /health as a liveness signal — it 503s when all upstreams are down, and restarting on that kills healthy gateways at the worst moment. TCP for alive, /health for ready, timeout above the 5s fan-out budget.
  • --env-file is the primary docker example (L12), with an accurate note on what it does and doesn't protect against.
  • cmd/fold: srv.Close() severs streams that outlive the 10s drain (L8).

Verification

make check green (race, lint 0 issues); make helm-check lints and renders all CI value sets including the new NetworkPolicy/egress/spread fixture; PDB gating verified in both directions (rendered at 2 replicas, skipped at 1); compose validates.

Deliberately not included (audit's optional tail, unchanged): opt-in span enduser.id (L7), cosign on checksums.txt (L14), a --healthcheck self-probe subcommand (L13).

🤖 Generated with Claude Code

Phase 4 (final) of the production-hardening audit (2026-08-11):

- Chart: opt-in NetworkPolicy template — the metrics listener's
  documented security model is network scope, and this is the
  chart-native way to provide it; optional egress lockdown bounds
  where a pod holding every upstream credential may connect.
- Chart: PodDisruptionBudget on by default (docs/deploy.md already
  claimed it was), rendered only when replicas > 1 so a single-replica
  deployment's drains are never blocked; default soft topology spread
  across zones and hosts; automountServiceAccountToken pinned false on
  the pod as well as the ServiceAccount.
- compose: fold/Prometheus/Grafana bind loopback like Redis already
  did — Grafana runs anonymous-Admin, and "do not put it on a network"
  now matches what the file does; images reference the release tag
  instead of mutable :latest.
- docs/deploy.md: "Rotating credentials" runbook (env vars are fixed
  at process start — hot reload does NOT re-read them; per-credential
  procedures incl. the EMA key's no-overlap caveat; IdP JWKS rollover
  needs nothing); explicit never-use-/health-as-liveness guidance for
  non-Helm deploys; --env-file as the primary docker example; the
  production checklist covers artifact verification, NetworkPolicy,
  and rotation.
- cmd/fold: srv.Close() severs streams that outlive the 10s drain.

Co-Authored-By: Claude Fable 5 <[email protected]>
@blakebauman
blakebauman merged commit eed60b7 into main Aug 12, 2026
7 checks passed
@blakebauman
blakebauman deleted the hardening/deploy-posture branch August 13, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant