spiffe / helm-charts-hardened

Apache License 2.0
12 stars 26 forks source link

Valid YAML checker #280

Open kfox1111 opened 3 months ago

kfox1111 commented 3 months ago

In our testing, we should helm template -> strict YAML parser to catch things like non unique keys in the generated YAML.

erikgb commented 3 months ago

I think the tools to validate this are limited, but I managed to get something out of yamllint:

$ helm template --values values.yaml charts/spire-0.18.1/spire | yamllint - --no-warnings
stdin
  338:1     error    wrong indentation: expected 2 but found 0  (indentation)
  400:1     error    wrong indentation: expected 2 but found 0  (indentation)
  493:1     error    trailing spaces  (trailing-spaces)
  621:1     error    trailing spaces  (trailing-spaces)
  634:11    error    duplication of key "securityContext" in mapping  (key-duplicates)
  710:13    error    wrong indentation: expected 14 but found 12  (indentation)
  760:1     error    trailing spaces  (trailing-spaces)
  772:11    error    wrong indentation: expected 12 but found 10  (indentation)
  902:5     error    wrong indentation: expected 6 but found 4  (indentation)
  905:7     error    wrong indentation: expected 8 but found 6  (indentation)
  924:5     error    wrong indentation: expected 6 but found 4  (indentation)
  927:7     error    wrong indentation: expected 8 but found 6  (indentation)
  949:5     error    wrong indentation: expected 6 but found 4  (indentation)
  952:7     error    wrong indentation: expected 8 but found 6  (indentation)
faisal-memon commented 3 months ago

Thanks @erikgb would be good to integrate this tool or a similar one.