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

ModifySet: all subpaths must be a prefix of the location value of the mutation #2892

Closed
tspearconquest opened this issue Jul 20, 2023 · 10 comments
Labels
bug Something isn't working stale

Comments

@tspearconquest
Copy link

What steps did you take and what happened:

apiVersion: mutations.gatekeeper.sh/v1
kind: ModifySet
metadata:
  name: assign-supplemental-group-to-pod-security-context-if-container-exists
spec:
  applyTo:
  - groups:
    - ""
    kinds:
    - Pod
    versions:
    - v1
  location: 'spec.securityContext.supplementalGroups'
  match:
    excludedNamespaces:
    - kube-node-lease
    - kube-public
    - kube-system
    kinds:
    - apiGroups:
      - ""
      kinds:
      - Pod
    namespaceSelector:
      matchExpressions:
      - key: special-label
        operator: Exists
    scope: Namespaced
  parameters:
    values:
    - 39500
    operation: merge
    pathTests:
    - subPath: "spec.initContainers[name: this-container-must-exist]"
      condition: MustExist

What did you expect to happen:
Add value "39500" to spec.securityContext.supplementalGroups for pods where init container "this-container-must-exist" exists

Anything else you would like to add:
I read through some of the other related issues regarding this deny, and understand the general concept of eventual consistency vs infinite looping mutations in the context of Assign mutations. Given that this is a ModifySet, however, I'd expected that the risk would be drastically reduced because I'm checking for the existence of another set object. I haven't seen an example provided which could lead to infinite looping.

Environment:

  • Gatekeeper version: 3.10.0
  • Kubernetes version: (use kubectl version):
    Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.3", 
    GitCommit:"9e644106593f3f4aa98f8a84b23db5fa378900bd", GitTreeState:"clean", BuildDate:"2023-03-15T13:40:17Z", 
    GoVersion:"go1.19.7", Compiler:"gc", Platform:"darwin/amd64"}
    Kustomize Version: v4.5.7
    Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.3", 
    GitCommit:"f18584a06fc476806da2e340e2eed960659871e8", GitTreeState:"clean", BuildDate:"2023-06-12T18:45:20Z", 
    GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
    
@tspearconquest tspearconquest added the bug Something isn't working label Jul 20, 2023
@stale
Copy link

stale bot commented Sep 19, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 19, 2023
@tspearconquest
Copy link
Author

Not stale

@stale stale bot removed the stale label Sep 19, 2023
Copy link

stale bot commented Nov 19, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 19, 2023
@tspearconquest
Copy link
Author

Not stale

/label mutation

@tspearconquest
Copy link
Author

/remove-lifecycle stale

@maxsmythe maxsmythe removed the stale label Nov 20, 2023
Copy link

stale bot commented Jan 20, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 20, 2024
@tspearconquest
Copy link
Author

/remove-lifecycle stale

@stale stale bot removed the stale label Jan 22, 2024
Copy link

stale bot commented Mar 22, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 22, 2024
@tspearconquest
Copy link
Author

/remove-lifecycle stale

@stale stale bot removed the stale label Mar 22, 2024
Copy link

stale bot commented May 21, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 21, 2024
@stale stale bot closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

2 participants