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] Evaluate userInfo with match & exclude filters #644

Closed
shivdudhani opened this issue Jan 21, 2020 · 6 comments
Closed

[BUG] Evaluate userInfo with match & exclude filters #644

shivdudhani opened this issue Jan 21, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@shivdudhani
Copy link
Contributor

As userInfo is defined under match and exclude it makes sense to evaluate all the conditions together.

Currently, they are independent checks
https://github.com/nirmata/kyverno/blob/4d2bea3c0de47d9c57d2c0b729e71f2ad16df8ca/pkg/engine/mutation.go#L57-L67

Needs to be updated for 'Mutation, 'Validation & 'Generation`. The conditions need to be evaluated together.

@JimBugwadia
Copy link
Member

The intention is that the UserInfo and other elements of the Match / Exclude are processed as a logical AND.

@JimBugwadia
Copy link
Member

This relates to: https://github.com/nirmata/kyverno/issues/634

@shravanshetty1
Copy link
Contributor

What needs to be done is clear, however why it needs to be done is unclear @shivdudhani @JimBugwadia

@shravanshetty1
Copy link
Contributor

Since i am unclear on why these changes are required, i would like these changes to be reviewed before i test them .etc. https://github.com/nirmata/kyverno/pull/662

@realshuting
Copy link
Member

@shravanshetty1 As long as MatchAdmissionInfo and MatchesResourceDescription are processed as a logical AND, I think it's ok to keep them separate.

For PR #662, I'm not sure if we want to move match/exclude filters out of the engine. The intent for the engine is to take any policy and the resource context(including userInfo and such), then apply the policy to the resource. The engine is also used in CLI, if we move that logic out of the engine, we'll have to add the filter checks in the CLI as well, before we pass to the engine.

@shravanshetty1
Copy link
Contributor

@realshuting I updated the PR with new understanding of the issue, kindly check

realshuting added a commit that referenced this issue Feb 20, 2020
#644 - Policy Rule Exclude conditions should be processed as a logical AND instead of a logical OR
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

No branches or pull requests

4 participants