Skip to main content

☑️ Prevent ConfigMap security vulnerability (CVE-2021-25742)

A vulnerability has been discovered in Kuberenetes where users with limited access to a Kubernetes cluster, but with the ability to create an Ingress object based on the NGINX Ingress Controller, could elevate privilege and access full cluster secrets (NVD severity of this issue: High).

More specifically, a user who can create or update NGINX ingress objects can use the custom snippets feature to obtain all secrets in the cluster. The allow-snippet-annotations configuration is set to true by default.

To affect NGINX ConfigMaps only, this rule will look for one or more of the following resource properties:

  • nginx-config
  • nginx-conf
  • ingress-nginx-controller


  • ingress-nginx
  • nginx-ingress

Targeted objects by this rule (types of kind): ConfigMap

Complexity: easy (What does this mean?)


This rule will fail​

If the key AND/OR the metadata.namespace key have one of the values listed above, AND the allow-snippet-annotations configuration is not set, or set explicitly to 'true'.

kind: ConfigMap
name: nginx-config
proxy-connect-timeout: "10"

Rule output in the CLI​

$ datree test *.yaml

>> File: failExample.yaml
❌ Prevent ConfigMap security vulnerability (CVE-2021-25742) [1 occurrence]
💡 Missing property object `allow-snippet-annotations` - set it to 'false' to override default behaviour

How to fix this failure​

kind: ConfigMap
namespace: nginx-ingress
allow-snippet-annotations: "false"

Read more​