Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: requiredDropCapabilities is not converted as validating AND mutating #399

Open
jaycci opened this issue Nov 12, 2023 · 0 comments
Open
Labels
bug Something isn't working triage Triage

Comments

@jaycci
Copy link

jaycci commented Nov 12, 2023

What happened?

I have a PSP rule with a .spec.requiredDropCapabilities specified. This field is simultaneously a "Validating" and "Mutating" field in PodSecurityPolicy.

Your tool does only generate the "Validating" rules, but not the "Mutating" ones.

So when I insert new objects in the k8s cluster with no "requiredDropCapabilities" specified, these objets are blocked by OPA (because no "requiredDropCapabilities" present) insted of being first mutated by OPA and added the missing field.

What policy engine were you generating policy for

Gatekeeper

Relevant log output

Source object:

apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: test
spec:
  requiredDropCapabilities:
  - MKNOD

Generated objects:

apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sPSPVolumeTypes
metadata:
  name: psp-k8spspvolumetypes-a8fae
spec:
  match:
    kinds:
      - apiGroups:
          - ""
        kinds:
          - Pod
  parameters: {}

---
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sPSPCapabilities
metadata:
  name: psp-k8spspcapabilities-31528
spec:
  match:
    kinds:
      - apiGroups:
          - ""
        kinds:
          - Pod
  parameters:
    allowedCapabilities: []
    requiredDropCapabilities:
      - MKNOD

The object K8sPSPCapabilities is only a "Validating" object (see definition in https://github.com/open-policy-agent/gatekeeper-library/blob/master/library/pod-security-policy/capabilities/template.yaml).

@jaycci jaycci added bug Something isn't working triage Triage labels Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Triage
Projects
None yet
Development

No branches or pull requests

1 participant