Zum Inhalt springen

Secret value committed in a manifest (ARCH10024)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key config.k8s.secret-in-manifest · Severity error · Category security · CWE CWE-798

A Secret whose data or stringData holds a value is that value in the repository - base64 is an encoding, not encryption. A container env entry whose name ends in a secret word with a written value is the same.

apiVersion: v1
kind: Secret
metadata:
name: db-credentials
type: Opaque
stringData:
password: change-me-123
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
containers:
- name: api
image: example/api:3.2.0
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-credentials
key: password

Keep secret values out of the repository: a sealed or external secret, or one the deployment creates, read with valueFrom.secretKeyRef.

  • valueFrom.secretKeyRef, valueFrom.configMapKeyRef and empty values.