Skip to content

fix(p5): isolation suite and static guards after Codex review (DRF-70) - #73

Merged
EurusDevSec merged 4 commits into
mainfrom
hoang/drf-70-p5-suite-fixes
Nov 24, 2026
Merged

EurusDevSec merged 4 commits into
mainfrom
hoang/drf-70-p5-suite-fixes

Conversation

@EurusDevSec

Copy link
Copy Markdown
Owner

Fixes the Codex REQUEST CHANGES review of the P5 code at 340558c (DRF-70, SPEC-P5 P5-T4.1/T4.2).

Blockers

  • Network cases: probes run as Jobs (VPC CNI does not enforce NetworkPolicy on a Pod without an owner). Only TIMEOUT counts as a network deny; refused, DNS and job errors are error:* and fail. eks mode needs NET_PHASE=control|enforced: control refuses to run while a tenant NetworkPolicy exists and expects every path open; enforced checks the control JSON and waits for a PolicyEndpoint per Git NetworkPolicy.
  • T07: only STS AccessDenied is a deny; an empty role annotation, missing IRSA env or other errors fail. The ARN is never printed.
  • P4 wrapper: each window.sh probe must exit 0 and print its full case set (platform included); a missing case or SKIP fails.

Should-fix

  • Admission records the denying policy (deny:kyverno:<policy>); an uncallable webhook is error:webhook.
  • can-i answers other than yes/no are errors; workload ServiceAccount cases added.
  • T03 adds a foreign-kind case (Deployment from gitops/lab) and checks nothing was created.
  • Evidence scrubbed (context name, ARNs, 12-digit IDs, EKS endpoints); an exit trap deletes and verifies every suite object.
  • gitops/check.sh: egress peers and ports, tenant label only on tenant namespaces, tenant group bound only in its own namespace, DB CIDRs match Terraform vpc_cidr; 6 new guard cases.
  • SPEC P5-T4.2: suspend Argo automated sync/self-heal before removing or changing a guardrail, Audit→Deny by Git commit, CIDR pre-flight. NetworkPolicy header threats → T10, T06.

Verification (Claude, throwaway kind cluster, 24/11)

  • MODE=kind with Kyverno Deny and Argo CD: 38 cases, 32 PASS, 0 FAIL, 6 SKIPPED_NEEDS_EKS, exit 0, no suite object left.
  • zdr-image-digest in Audit: FAIL on T14-tag, T14-registry, T15; exit 1.
  • Job wrapper harness: OPEN, TIMEOUT, DNS error and T07 without IRSA classified correctly.
  • gitops/tests/check_guards.sh: 71/71; gitops/check.sh: PASS.

Not verified: eks control/enforced phases, T07 and P4 probes on a real cluster (L3 window, separate approval).

🤖 Generated with Claude Code

Suite (tests/isolation/run.sh):
- network and T07 probes run as Jobs (VPC CNI ignores ownerless Pods);
  only TIMEOUT is a network deny, refused/DNS/job errors fail
- eks needs NET_PHASE=control|enforced; enforced checks the control JSON
  and waits for a PolicyEndpoint per Git NetworkPolicy
- T07: only STS AccessDenied is a deny; missing annotation/IRSA is an error
- P4 wrapper requires exit 0 and the full case set, platform included
- admission names the denying policy, webhook failure is an error;
  can-i non yes/no is an error; workload SA cases; T03 foreign kind
- evidence scrubbed; exit trap removes and verifies suite objects

check.sh: egress peers and ports, tenant label scope, tenant group bound
only in its namespace, DB CIDRs match Terraform vpc_cidr; 6 guard cases.
SPEC P5-T4.2: suspend Argo self-heal before removing guardrails, Audit to
Deny by commit, CIDR pre-flight. NetworkPolicy header: T10, T06.

Kind (Claude, 24/11): 38 cases, 32 PASS, 0 FAIL, 6 SKIPPED_NEEDS_EKS;
one policy in Audit exits 1; guards 71/71.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 24, 2026 12:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

EurusDevSec and others added 3 commits November 24, 2026 20:42
- control: NetworkPolicy list must succeed and be empty, else stop before
  probing; enforced accepts only a fully passing control receipt of
  RUN_ID-control for the same sandbox (fixed result codes)
- job(): read a RESULT line only when the Job is Complete=True; a failed
  Job is job-failed even if it logged RESULT TIMEOUT
- cleanup: failed lists are unverified, not empty; cleanup is a recorded
  case before RESULT; trap still cleans on abnormal exit
- RBAC by SubjectAccessReview (evaluationError is an error, not a deny)
- T03: failed Deployment or namespace list is an error
- T07 apply errors and control-file values kept off the output;
  observed is scrubbed too
- check.sh: each tenant's egress is exactly DNS 53, DB 5432, HTTPS 443
  outside the VPC, app 8080 in-tenant; 3 guard cases

Kind (Claude, 24/11): 39 cases, 33 PASS, 0 FAIL, 6 SKIPPED_NEEDS_EKS;
Audit self-test exits 1; Job and cleanup harness pass; guards 74/74.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Third Codex pass on PR #73 at 1035cbc:
- job(): the kubectl logs read must succeed before a RESULT line is
  parsed; a failed read is job-log-error
- cleanup also deletes and waits for window.sh probe Pods (zdr-probe) in
  tenant-a, tenant-b and zdr-platform, then counts them
- scrub loops so adjacent 12-digit IDs are all replaced
- check.sh: egress keyed by the policy podSelector (Egress policyTypes
  only); ports must be int with TCP/UDP; 2 guard cases

Kind (Claude, 24/11): 39 cases, 33 PASS, 0 FAIL, 6 SKIPPED_NEEDS_EKS;
Audit self-test exits 1; harness: failing log read -> job-log-error,
leftover zdr-probe Pod removed before verified-empty; guards 76/76.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex approved PR #73 at ae20196 with two non-blocking should-fix items:
- check.sh: a NetworkPolicy without policyTypes counts its egress rules
  (Kubernetes adds Egress when egress rules exist); guard case for an
  extra egress policy without policyTypes
- run.sh exports PROBE_RUN; window.sh labels probe Pods with
  rag.zero-drift.io/probe-run when it is set (unchanged otherwise);
  cleanup deletes and counts only this run's probes

Kind (Claude, 24/11): 39 cases, 33 PASS, 0 FAIL, 6 SKIPPED_NEEDS_EKS;
Audit self-test exits 1; this run's probe removed, another run's probe
kept; guards 77/77.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EurusDevSec
EurusDevSec merged commit 95fd5cf into main Nov 24, 2026
2 checks passed
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.

2 participants