kedacore / keda-olm-operator

Operator for deploying KEDA Controller on OperatorHub.io/OLM
Apache License 2.0
31 stars 23 forks source link

Set "readOnlyRootFilesystem: true" in operator pod template to match operand #243

Closed jkyros closed 2 months ago

jkyros commented 2 months ago
   "Type": "Kubernetes Security Check",
              "ID": "KSV014",
              "AVDID": "AVD-KSV-0014",
              "Title": "Root file system is not read-only",
              "Description": "An immutable root file system prevents applications from writing to their local disk. This can limit intrusions, as attackers will not be able to tamper with the file system or write foreign executables to disk.",
              "Message": "Container 'custom-metrics-autoscaler-operator' of Pod 'custom-metrics-autoscaler-operator-5b6fb58767-zmrvr' should set 'securityContext.readOnlyRootFilesystem' to true",
              "Namespace": "builtin.kubernetes.KSV014",
              "Query": "data.builtin.kubernetes.KSV014.deny",
              "Resolution": "Change 'containers[].securityContext.readOnlyRootFilesystem' to 'true'.",
              "Severity": "HIGH",
              "PrimaryURL": "https://avd.aquasec.com/misconfig/ksv014",
              "References": [
                "https://kubesec.io/basics/containers-securitycontext-readonlyrootfilesystem-true/",
                "https://avd.aquasec.com/misconfig/ksv014"
              ],
              "Status": "FAIL",

NOTE: I did re-run a trivy scan with a bundle built from this PR and this does fix the issue

Checklist

Fixes #

joelsmith commented 2 months ago

Looks good, but could you please also add it to https://github.com/jkyros/custom-metrics-autoscaler-operator/blob/fix-writeable-root-fs/bundle/manifests/keda.clusterserviceversion.yaml#L654 so that we have a consistent set of manifests across the repo? You can add it either by doing make bundle (which will also change a few other lines showing when it was created) or just editing by hand since it's just one line.

Even though the bundle dir really only gets used when testing, I like the idea of keeping it updated.

jkyros commented 2 months ago

Thanks! Great catch. I also re-ordered the field so it's at the bottom of the securityContext section -- I noticed the generators alphabetize the fields when they generate and I was naughty and hadn't.

joelsmith commented 2 months ago

LGTM!