Safeguard
Security Guides•

Can developers bypass an admission webhook by setting a label?

Yes, if a webhook relies on an objectSelector. Kubernetes docs say users may skip it by setting labels, so use admin owned namespace labels for policy.

Safeguard Security Team
3 min read

Yes, if the webhook relies on an objectSelector. The Kubernetes docs say to use it only if the webhook is opt in, because end users may skip the webhook by setting the labels. Use admin owned namespace labels for mandatory policy.

Two selectors, two owners

An admission webhook can narrow what it sees. The namespaceSelector matches on the labels of the containing namespace. The objectSelector matches on the labels of the object itself, evaluated against both the new and old object, and it matches if either matches.

The difference is who controls the label. A developer who can create a Deployment can put any label on it. Namespace labels usually need a higher permission.

SelectorMatches onWho typically controls itGood for
namespaceSelectorLabels on the namespaceAdminsMandatory policy
objectSelectorLabels on the objectWhoever creates the objectOpt in features

The bypass in plain terms

Suppose a policy webhook uses an objectSelector so that it only checks objects labeled for review. An author who wants to avoid the check simply leaves the label off. The docs describe the exact risk: if the selector is used for anything that must be enforced, users can sidestep it.

The docs add a detail: an object that cannot have labels, or a null old object on create, is not considered to match on that side. Selector logic has edge cases, so keep mandatory policy simple.

How to design for enforcement

  1. Match broadly. Cover all namespaces except a small, named exclusion list.
  2. Put exclusions in namespaceSelector, and protect who can label namespaces. Test who can edit namespace labels with RBAC checks.
  3. Do not exclude kube-system by habit. Understand why you do it and what runs there.
  4. Review failurePolicy at the same time. The default is Fail, which rejects requests when the webhook errors. Ignore lets them through. See webhook timeouts and failure policy tradeoffs.
  5. Use matchPolicy Equivalent, which the docs recommend so webhooks keep intercepting resources after upgrades enable new versions.

Audit it

List every webhook configuration, read each selector, and ask who can change the labels it depends on. The answer often shows a policy that looks strict and is easy to skip. Related: who can weaken Kubernetes admission controls.

Try it yourself

Try it yourself

Click through it at your own pace, or open it full screen. Notice that the gate applies to every change, not only the ones that ask to be checked.

Quick check

Is objectSelector ever the right choice?

Yes, for opt in features where skipping the webhook is harmless.

What does the namespaceSelector do to cluster scoped objects?

The docs say it has no effect on cluster scoped resources other than Namespace objects.

Safeguard policies and gates apply to every change that passes through them, and a free scan is at https://gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.