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

Add pathTests to container-drop-net-raw #65

Open
NissesSenap opened this issue Mar 9, 2022 · 0 comments
Open

Add pathTests to container-drop-net-raw #65

NissesSenap opened this issue Mar 9, 2022 · 0 comments

Comments

@NissesSenap
Copy link
Contributor

Today the following yaml runs no matter what.

apiVersion: mutations.gatekeeper.sh/v1beta1
kind: Assign
metadata:
  name: container-drop-net-raw
spec:
  match:
    scope: Namespaced
    kinds:
      - apiGroups: ["*"]
        kinds: ["Pod"]
  applyTo:
    - groups: [""]
      versions: ["v1"]
      kinds: ["Pod"]
  location: "spec.containers[name:*].securityContext.capabilities.drop"
  parameters:
    assign:
      value:
        - NET_RAW

But what happens if the user provides a even better value, say all

This could be written something like

apiVersion: mutations.gatekeeper.sh/v1beta1
kind: Assign
metadata:
  name: container-drop-net-raw
spec:
  match:
    scope: Namespaced
    kinds:
      - apiGroups: ["*"]
        kinds: ["Pod"]
  applyTo:
    - groups: [""]
      versions: ["v1"]
      kinds: ["Pod"]
  location: "spec.containers[name:*].securityContext.capabilities.drop"
  parameters:
    assign:
      value:
        - NET_RAW
    pathTests:
      - subPath: "spec.containers[name:*].securityContext.capabilities.drop[ALL]"
        condition: MustNotExist

I'm not sure on how the array should look like but something like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant