Repository navigation
Description
Problem
The NetworkPolicies of dan-petty/homelab#276 (plan PR dan-petty/homelab#510) admit the pods with app.kubernetes.io/name: devops-cli-job and app.kubernetes.io/component: project-review in namespace devops to Prometheus (TCP 9090) and Loki (TCP 3100). Loki has no authentication.
The admission policy of the roadmap Service (k8s/devops/roadmap-service/admissionpolicy.yaml:259-268) requires app.kubernetes.io/component: roadmap-stage on the pod of a stage Job and refuses it on other pods. For a Job that is not a stage Job, it accepts every other component value. So ServiceAccount roadmap-service can create a Job whose pod carries project-review and reads all logs of the cluster through Loki.
The project review pods come from the Argo WorkflowTemplate project-review of #4736, not from a Job of the Service.
Done when
- The admission policy refuses a Job of
roadmap-servicewhose pod template carriesapp.kubernetes.io/component: project-review. - The policy test proves the refusal, and a stage Job and an implement Job are still admitted.
Alternatives check of 2026-11-27: in-use.
The repository already uses this tool.
Tool: kubernetes/kubernetes (https://github.com/kubernetes/kubernetes), Apache-2.0, last activity 2026-11-27, maintained.
Reason: Searches surfaced only container images and docs pages, no separate tool for a label-scoped Job refusal; the built-in CEL admission policy the project already uses closes the gap with one added conjunct, so the issue names the tool.
Covers:
- CEL expression refuses a named component value on non-stage Job templates
- Rule sits in the existing policy that already gates Service Jobs
- Runs in the API server, so no extra controller, CRD or agent
Lacks:
- No built-in test harness for the denial; the test case is project code
- Refuses only enumerated values, not unknown component labels
- No knowledge of NetworkPolicy exposure; the Loki path closes only for this label
Proposed design
Problem statement
The roadmap-service admission policy admits a non-stage Job whose pod template carries app.kubernetes.io/component: project-review. The NetworkPolicies of dan-petty/homelab#276 admit that label to Prometheus and Loki. Loki has no authentication, so the ServiceAccount reads all cluster logs. The change refuses that label on Service Jobs and keeps stage and implement Jobs admitted.
Acceptance criteria
Requirement: Refuse project-review on non-stage Service Jobs
The roadmap-service admission policy SHALL refuse a Job whose pod template sets app.kubernetes.io/name: devops-cli-job and app.kubernetes.io/component: project-review, when the Job is not a stage Job.
Scenario: Non-stage project-review Job is refused
- WHEN
uv run devops ci --check --only k8sruns the policy test case for the non-stage Job withapp.kubernetes.io/component: project-review - THEN The k8s check passes and the policy test reports that the policy refuses the Job.
Requirement: Keep stage Jobs admitted
The roadmap-service admission policy SHALL admit a stage Job whose pod template sets app.kubernetes.io/name: devops-cli-job and app.kubernetes.io/component: roadmap-stage.
Scenario: Stage Job is admitted
- WHEN
uv run devops ci --check --only k8sruns the policy test case for the stage Job - THEN The k8s check passes and the policy test reports that the policy admits the stage Job.
Requirement: Keep implement Jobs admitted
The roadmap-service admission policy SHALL admit a non-stage Job whose pod template sets app.kubernetes.io/name: devops-cli-job and does not set app.kubernetes.io/component to roadmap-stage or project-review.
Scenario: Implement Job with no component label is admitted
- WHEN
uv run devops ci --check --only k8sruns the policy test case for a non-stage Job whose pod template sets onlyapp.kubernetes.io/name: devops-cli-job - THEN The k8s check passes and the policy test reports that the policy admits the Job.
Existing Tool Considered
Verdict in-use for kubernetes/kubernetes (ValidatingAdmissionPolicy with CEL), from the alternatives check in the issue body. That block gives what the tool covers and lacks. The change adds one conjunct to the existing non-planner expression in k8s/devops/roadmap-service/admissionpolicy.yaml. It also adds the policy test case that the tool lacks.
Key questions
- What does the current policy admit for a non-stage Service Job?: The non-planner branch requires
app.kubernetes.io/name: devops-cli-job. It then requiresvariables.stageto equal the presence ofapp.kubernetes.io/component: roadmap-stage. For a non-stage Job it refusesroadmap-stageand accepts every other component value, includingproject-review. [sources: k8s/devops/roadmap-service/admissionpolicy.yaml:259-268] - Which mechanism enforces the policy?: A Kubernetes ValidatingAdmissionPolicy with CEL. The expression reads
variables.plannerandvariables.stage, which the policy defines. [sources: k8s/devops/roadmap-service/admissionpolicy.yaml:259-268] - Where does the change refuse the project-review component?: Add one conjunct to the non-planner CEL expression in
k8s/devops/roadmap-service/admissionpolicy.yaml. The conjunct requiresvariables.stageto be true, or the component to be absent or notproject-review. The planner branch, the name check and the stage rule stay unchanged. (best practice) [sources: k8s/devops/roadmap-service/admissionpolicy.yaml:259-268]- Chosen: Extend the existing CEL expression. The policy already gates Service Jobs. One conjunct closes the gap and keeps the other paths.
- Rejected: Add a separate ValidatingAdmissionPolicy. A second policy repeats the same match and adds ordering and maintenance.
- Rejected: Replace the policy with Kyverno. The project uses the built-in CEL policy. A new controller adds a dependency and no benefit.
- Should the policy refuse every unknown non-stage component or only project-review?: Refuse only
project-review. The issue names that value. The stage and implement paths stay admitted. An allowlist needs proof of every legitimate component and can refuse a valid Job. (best practice) [sources: k8s/devops/roadmap-service/admissionpolicy.yaml:259-268]- Chosen: Refuse only project-review. It closes the named Loki path and leaves the stage and implement paths unchanged.
- Rejected: Allowlist known component values. The issue names no full list. A missing value would block valid Jobs.
- Rejected: Change the NetworkPolicy only. The issue assigns the fix to the admission policy. The policy gap stays for other consumers.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 27, 2026
A live security gap lets the Service read all cluster logs through unauthenticated Loki.Both work on the roadmap-service admission policy, but #2696 created the policy and this candidate adds a specific refusal for the project-review label.devops-cli-service commentedon Nov 27, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
devops-cli-service commentedon Nov 27, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (7)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 27, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 28, 2026
Released in v0.232.6: https://github.com/dan-petty/devops-cli/releases/tag/v0.232.6
devops-cli-service commentedon Nov 28, 2026
Live since 2026-11-28 06:56 UTC