mirror of
https://gitlab.opencode.de/bmi/opendesk/deployment/opendesk.git
synced 2025-12-06 07:21:36 +01:00
50 lines
1.5 KiB
YAML
50 lines
1.5 KiB
YAML
# Source: https://github.com/kyverno/policies/tree/main/pod-security
|
|
# License: Apache-2.0
|
|
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: secrets-not-from-env-vars
|
|
labels:
|
|
opendesk.eu/security-id: wld-iso-009
|
|
annotations:
|
|
policies.kyverno.io/title: Disallow Secrets from Env Vars
|
|
policies.kyverno.io/severity: medium
|
|
policies.kyverno.io/subject: Pod, Secret
|
|
kyverno.io/kyverno-version: 1.6.0
|
|
policies.kyverno.io/description: >-
|
|
Secrets used as environment variables containing sensitive information may, if not carefully controlled,
|
|
be printed in log output which could be visible to unauthorized people and captured in forwarding
|
|
applications. This policy disallows using Secrets as environment variables.
|
|
spec:
|
|
validationFailureAction: Audit
|
|
background: true
|
|
rules:
|
|
- name: secrets-not-from-env-vars
|
|
match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Pod
|
|
validate:
|
|
message: "Secrets must be mounted as volumes, not as environment variables."
|
|
pattern:
|
|
spec:
|
|
containers:
|
|
- name: "*"
|
|
=(env):
|
|
- =(valueFrom):
|
|
X(secretKeyRef): "null"
|
|
- name: secrets-not-from-envfrom
|
|
match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Pod
|
|
validate:
|
|
message: "Secrets must not come from envFrom statements."
|
|
pattern:
|
|
spec:
|
|
containers:
|
|
- name: "*"
|
|
=(envFrom):
|
|
- X(secretRef): "null" |