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] Don't allow policy with variables within specific fields. #1840

Closed
kacejot opened this issue Apr 27, 2021 · 5 comments · Fixed by #1940
Closed

[BUG] Don't allow policy with variables within specific fields. #1840

kacejot opened this issue Apr 27, 2021 · 5 comments · Fixed by #1940
Assignees
Labels
bug Something isn't working

Comments

@kacejot
Copy link
Contributor

kacejot commented Apr 27, 2021

Software version numbers
State the version numbers of applications involved in the bug.

  • Kubernetes version: 1.21.0
  • Kyverno version: 1.3.5

Describe the bug
For now we can create a policy with variables within path field in JSONPatch mutation.
We should disallow such cases.

Example policy

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: policy-patch-cm
spec:
  rules:
    - name: pCM1
      match:
        resources:
          name: "config-game"
          kinds:
          - ConfigMap
      mutate:
        patchesJson6902: |-
          - path: "{{request.object.path.root}}/data/ship.properties"
            op: add
            value: |
              type=starship
              owner=utany.corp
          - path: "/data/newKey1"
            op: add
            value: newValue1
@kacejot kacejot added the bug Something isn't working label Apr 27, 2021
@kacejot kacejot self-assigned this Apr 27, 2021
@kacejot kacejot added this to the Kyverno Release 1.3.7 milestone Apr 27, 2021
@kacejot
Copy link
Contributor Author

kacejot commented Apr 28, 2021

@JimBugwadia, could you please describe additional fields that should not contain variables?

@JimBugwadia JimBugwadia changed the title [BUG] Don't allow policy with variables within spesific fields. [BUG] Don't allow policy with variables within specific fields. May 18, 2021
@JimBugwadia
Copy link
Member

@kacejot - the other place we do not allow variables is in match / exclude kind fields.

@NoSkillGirl
Copy link
Contributor

@JimBugwadia - we do not allow variables in the complete match/exclude block or just in match.kind/exclude.kind?

@NoSkillGirl
Copy link
Contributor

@JimBugwadia - we do not allow variables in the complete match/exclude block or just in match.kind/exclude.kind?

@JimBugwadia , @chipzoller , @realshuting ??

@JimBugwadia
Copy link
Member

Variables are currently not allowed in the kind field. I am not aware of any other restrictions.

However, see: #1954

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants