Native admission: VAP and MAP
Rollout rules without a webhook: a ValidatingAdmissionPolicy forbids foreign registries and :latest, a MutatingAdmissionPolicy sets default limits.
The fifth lesson of the hardening track. After lesson 03 Pod Security won't let a privileged Pod in, but a leaked CI token can still roll out an image from a foreign registry, with the :latest tag or without limits. The lesson is about rollout rules built on the apiserver's own policies, without separate webhook services.
Threat model
The attacker has a CI token that can create Deployments. They write their manifests carefully to fit the restricted level, but they bring their own image and set no resource limits.
Attack path
- A Deployment with an image from a public registry.
- A Deployment with the
:latesttag from your own registry, which can be quietly overwritten. - A Deployment without
limitsthat can take all the memory of the node.
Checklist
- Images are accepted only from your own registry and only with an exact tag or digest.
- The rule checks both Pods and Deployments, so CI sees the denial right away.
- A new policy runs in
WarnandAuditfirst, then inDeny. - Default values are filled in by a policy instead of being demanded by a denial.
- CEL expressions don't fail on missing fields, and security rules have
failurePolicy: Fail.
Practice
A lab on the shared cluster of the track. The attack rolls out three Deployments with the CI token. You write a ValidatingAdmissionPolicy and a MutatingAdmissionPolicy so that two Deployments are blocked, the third gets default limits, and the shop's own rollouts still pass.
Done reading?
Mark the lesson as read to move your track progress forward.
Lesson marked as done.
Practice
Fix a local lab. The agent checks your work and gives hints if you get stuck.
Full access to all labs
One payment, no auto-renewal · Terms
Progress saved in this browser
Clear your history or open this on your phone, and the marks will be gone. Leave your email and they'll move to your account. No password needed.
Done. moved to your account. You can see your progress on any device. My progress