Shopify / kubeaudit

kubeaudit helps you audit your Kubernetes clusters against common security controls
MIT License
1.91k stars 184 forks source link

kubeaudit autofix: triple dash issue in multiline string #582

Open til69 opened 7 months ago

til69 commented 7 months ago
ISSUE TYPE

BUG REPORT

SUMMARY

--- gets mis-interpreted and is an issue at least in the first occurring multiline string

ENVIRONMENT
STEPS TO REPRODUCE

manifest.yaml

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: multiline-issue
data:
  k1: |
    ---
    This gets messed up
  k2: |
    --
    This is fine
  k3: |
    -----BEGIN CERTIFICATE-----
    It's an issue in certificates, too...
    -----END CERTIFICATE-----
kubeaudit autofix -f manifest.yaml -o out.yaml
EXPECTED RESULTS

out.yaml

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: multiline-issue
data:
  k1: |
    ---
    This gets messed up
  k2: |
    --
    This is fine
  k3: |
    -----BEGIN CERTIFICATE-----
    It's an issue in certificates, too...
    -----END CERTIFICATE-----
ACTUAL RESULTS

out.yaml

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: multiline-issue
data:
  k1: ""

    ---
    This gets messed up
  k2: |
    --
    This is fine
  k3: |
    -----BEGIN CERTIFICATE-----
    It's an issue in certificates, too...
    -----END CERTIFICATE-----
github-actions[bot] commented 7 months ago

Thanks for opening your first issue here! Be sure to follow the issue template!