feat(security): enable mendys-prod NetworkPolicy + guard against FuzeInfra#501 recurring - #552
Open
izzywdev wants to merge 6 commits into
Open
feat(security): enable mendys-prod NetworkPolicy + guard against FuzeInfra#501 recurring#552izzywdev wants to merge 6 commits into
izzywdev wants to merge 6 commits into
Conversation
…nst FuzeInfra#501 recurring Now that FuzeInfra#501 (authentik-server-ingress port:0 blocking every Argo sync) is fixed by #534, this completes #493: securityService.networkPolicy was never actually applied in prod because syncs were already failing when it landed. Flips it on in values-prod.yaml, mirroring the authentik policy's own base-off/prod-on pattern. Also adds the two guardrails discussed while diagnosing #501: - gate-networkpolicy-ports (helm-validate.yml): kubeconform validates that a NetworkPolicy port is shaped like an IntOrString, not that it's in range. A missing values.yaml default renders as `port: 0`, which type-checks fine and only fails at live API-server admission — exactly how #501 shipped undetected. This step statically rejects any rendered NetworkPolicy port outside 1-65535, no cluster required. - CLAUDE.md: a guideline against "fixing" a kubeconform failure by casting around it (`| int`, `| default`, etc.) instead of restoring the missing value — the specific anti-pattern that masked #501's root cause. Closes #493.
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
CLAUDE.md had pre-existing CRLF endings from before gate-line-endings existed; touching it in this PR tripped the gate on the file's whole encoding, not just the new content. Renormalizes the file to LF and pins it in .gitattributes so future edits don't retrip this.
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
…etworkpolicy-and-ci-gate # Conflicts: # CLAUDE.md
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Description
Closes out #493 for real, and adds two guardrails against the class of bug that delayed it (FuzeInfra#501).
Background: #497 added
securityService.networkPolicy(default ON) so mendys-prod could reachfuzefront-securityin-cluster. Before it ever synced, #523 accidentally dropped itsport/namespace keys (and flipped itsenabledtofalse) in a large values.yaml restructuring, which also broke the pre-existingauthentik.networkPolicythe same way — renderingport: 0, which the live API server rejects. That failed every Argo sync of the wholefuzefrontApplication for days (FuzeInfra#501), until #534 restored the values and hardened both templates with inline| defaultfallbacks. #534 deliberately leftsecurityService.networkPolicy.enabled: false, since the policy had never actually been live — flipping it on was called out as a separate deploy-window decision. This PR is that decision.Fixes #493
🔄 Type of Change
🔧 Implementation Details
Changes Made
deploy/helm/fuzefront/values-prod.yaml—securityService.networkPolicy.enabled: true, mirroring theauthentik.networkPolicybase-off/prod-on pattern already established for the sibling policy..github/workflows/helm-validate.yml— newgate-networkpolicy-portsstep.kubeconformvalidates that aNetworkPolicyport is shaped like anIntOrString, not that it's in range. A missingvalues.yamldefault renders asport: 0, which type-checks fine and only fails at live API-server admission — exactly how FuzeInfra#501 shipped undetected (a| intcast silently coerced the missing value to0, which is a syntactically valid integer). This step statically rejects any renderedNetworkPolicyport outside 1–65535, directly against the rendered manifest — no cluster required. Named ports (e.g.port: http) are valid and deliberately left unchecked.CLAUDE.md— new "Helm values hygiene" section: don't cast around (| int,| default, …) a kubeconform failure — investigate why the value is undefined and restore it explicitly invalues.yaml. Also flags that a "fix missing defaults" commit dominated by deletions is a restructuring and needs a rendered-manifest diff, not just a line diff; and that two PRs touching the same top-levelvalues.yamlkey concurrently is the highest-risk moment for this exact class of bug.🧪 Testing
helm lint+helm template(both overlays) — clean.kubeconform -ignore-missing-schemasagainst the full rendered manifest set (values.yaml+values-prod.yaml) — 43 valid, 0 errors.security-networkpolicy.yamlwith the flag on: all three ingress rules renderport: 3002correctly.gate-networkpolicy-portsscript logic against three cases: (a) the current valid render — passes; (b) a syntheticNetworkPolicywithport: 0— correctly fails; (c) a syntheticNetworkPolicywith a named port (port: http) — correctly passes (no false positive).mendys-prodpod,curl -sv --max-time 5 http://fuzefront-security.fuzefront.svc.cluster.local:3002/api/v1/security/sessionshould reach the service, and the existing Traefik + intra-fuzefront paths tofuzefront-securityshould still work.Code Quality
🔗 Related Issues and PRs
📝 Additional Notes
Deployment Notes
masterautomatically per this repo's GitOps model)No FuzeInfra-side change needed.
Generated by Claude Code