Skip to content

✨ feat(netguard): production --allow-private-sinks opt-in (NET-01) - #146

Merged
konih merged 1 commit into
mainfrom
net-01-allow-private-sinks-impl
Jul 31, 2026
Merged

konih merged 1 commit into
mainfrom
net-01-allow-private-sinks-impl

Conversation

@konih

@konih konih commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

NET-01 — production --allow-private-sinks opt-in (DR-FIND-05 Option A)

Implements the operator's Option A decision (2026-07-31): an explicit, secure-by-default-OFF, cluster-admin-only opt-in so sink endpoints may resolve to RFC1918 / IPv6-ULA (in-cluster ClusterIP) addresses on published production images — for exporting to in-cluster Postgres/MinIO/NATS, which netguard's deny-by-default blocked on v0.10.0 (DR lab dr-20260731-80aef1 Wave 2b). Companion to the operator's planning PR #144.

Design

One manager flag --allow-private-sinks (default false) drives both enforcement layers so they never diverge (cmd/main.go wires both setters from one cfg):

  • dial-time (netguard): validateAddress(addr, allowPrivate) permits IsPrivate() (RFC1918/ULA) only; loopback, link-local (incl. cloud-metadata 169.254.169.254), unspecified, multicast, CGNAT, benchmark stay denied. Strictly narrower than the integration build tag's full skip.
  • admission (validation): isDeniedIP conditionally permits IsPrivate() while every other deny-list entry — including the locked denyCIDRs — stays enforced. atomic.Bool for race-free reads.

Helm allowPrivateSinks (default false) renders the arg only when true. Not a CRD/tenant field — sink-CR authors cannot widen the deny-list.

Security review — APPROVE

Independent reviewer verified: fails closed by default / when the setter is never invoked; narrow allow keeps all non-private denials at both layers even when ON; admission↔dial parity with confirmed end-to-end dial-path reach (all sink backends funnel through DefaultDialer); not tenant-controllable; SAFE-comment/denyCIDRs verbatim (guard test green); race-clean; strong discriminator tests. 2 P3 non-blocking notes only.

Gates

build ✅ · netguard+validation+cmd -race ✅ · helm-unittest 24/24 ✅ · sonar_ko_07 SAFE-comment guard ✅ · make lint 0 issues ✅ · verify:headers ✅. Docs flipped planned→shipped (Helm value shipped top-level allowPrivateSinks per chart convention; see agent-context decisions).

Residual SSRF risk (documented)

When enabled, a principal who can create/edit sink CRs can aim connection-tests/exports at RFC1918/VPC peers reachable from the manager pod. Enable only in private clusters with trusted CR authors. Default remains deny.

DR-FIND-05 Option A. Adds an explicit, secure-by-default-OFF, cluster-admin-only
opt-in so sink endpoints may resolve to RFC1918 / IPv6-ULA (in-cluster ClusterIP)
addresses on published production images — for exporting to in-cluster
Postgres/MinIO/NATS, which netguard's deny-by-default blocked on v0.10.0.

One manager flag --allow-private-sinks (default false) drives BOTH layers so they
never diverge:
- dial-time: netguard.SetAllowPrivateSinks narrows validateAddress to permit
  IsPrivate() (RFC1918/ULA) only; loopback, link-local (incl. metadata
  169.254.169.254), unspecified, multicast, CGNAT, and benchmark stay denied.
  Strictly narrower than the integration build tag's full allowPrivate skip.
- admission: validation.SetAllowPrivateSinks makes isDeniedIP conditionally
  permit IsPrivate() while every other deny-list entry (incl. the locked
  denyCIDRs) stays enforced. atomic.Bool for race-free concurrent reads.

Helm value allowPrivateSinks (default false) renders the flag only when true;
NOT a CRD/tenant field, so sink authors cannot widen the deny-list. Docs flipped
planned -> shipped with the residual-SSRF-risk callout.

Tests (TDD, race-clean): dialer + admission matrices incl. the discriminators
(metadata/link-local/loopback stay denied under the opt-in; ULA allowed;
DNS->RFC1918 allowed on / denied off; mixed private+metadata answer fails
closed; default-closed when the setter is never called); startup-flag parse;
helm-unittest arg present only when true. sonar_ko_07 SAFE-comment guard intact.
@konih
konih merged commit 65047b1 into main Jul 31, 2026
23 of 24 checks passed
@konih
konih deleted the net-01-allow-private-sinks-impl branch July 31, 2026 11:49
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

konih added a commit that referenced this pull request Jul 31, 2026
Bump chart version/appVersion 0.10.0 -> 0.11.0 for the next minor. Unreleased
since v0.10.0: feat(netguard) NET-01 --allow-private-sinks opt-in (#146) +
fix(controller) inventory store source Start non-blocking / DR-FIND-01 (#143),
plus DR-FIND-03 lab-bootstrap docs (#148), UI-TEST-01 (#147), SEC-04j
CI-hardening (#150).
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