# R-SEC-02 — the conformance CI trigger cannot escalate to arbitrary privileged execution. # # Each DENY case below is a real escalation path, not a style violation. The one that matters # most is `evil-command`: correct SA, correct image, arbitrary command. That is the attack the # whole model exists to stop, and RBAC alone cannot — Kubernetes places no `use` check on # serviceAccountName, so `create jobs` in this namespace IS the privileged identity without # this policy. # # user-info.yaml supplies the requesting identity. WITHOUT it the policy's `subjects` match # never fires and every case trivially passes — a test that proves nothing. apiVersion: cli.kyverno.io/v1alpha1 kind: Test metadata: name: conformance-trigger-job-shape policies: - ../../admission/conformance-trigger-job-shape.yaml resources: - resources.yaml userinfo: user-info.yaml results: # ---- the committed run is ADMITTED ---- - policy: conformance-trigger-job-shape rule: trigger-may-create-only-the-committed-conformance-run kind: Job resources: [good-run] result: pass - policy: conformance-trigger-job-shape rule: trigger-volumes-must-be-workspace-or-results kind: Job resources: [good-run] result: pass - policy: conformance-trigger-job-shape rule: trigger-args-must-be-the-committed-flags kind: Job resources: [good-run] result: pass # ---- THE escalation: runner SA + arbitrary command ---- - policy: conformance-trigger-job-shape rule: trigger-may-create-only-the-committed-conformance-run kind: Job resources: [evil-command, evil-image, tag-not-digest, host-namespaces] result: fail # ---- an extra volume is the way out of a constrained pod ---- - policy: conformance-trigger-job-shape rule: trigger-volumes-must-be-workspace-or-results kind: Job resources: [extra-volume] result: fail # ---- args beyond the committed flags ---- - policy: conformance-trigger-job-shape rule: trigger-args-must-be-the-committed-flags kind: Job resources: [injected-args] result: fail