-
Notifications
You must be signed in to change notification settings - Fork 596
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 authz library #8002
Add authz library #8002
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8002 +/- ##
==========================================
+ Coverage 67.65% 67.72% +0.07%
==========================================
Files 361 362 +1
Lines 16638 16705 +67
==========================================
+ Hits 11256 11314 +58
- Misses 4690 4695 +5
- Partials 692 696 +4 ☔ View full report in Codecov by Sentry. |
pkg/auth/event_policy.go
Outdated
strings.EqualFold(to.Selector.APIVersion, resourceAPIVersion) && | ||
strings.EqualFold(to.Selector.Kind, resourceGVK.Kind) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to match the full APIVersion and Kind or just kind + group ? what happens when there is a new version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but still I don't think we want to match the version here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated as discussed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn. I deleted my original comment by accident 🤦
Only for history: We thought about this initially in the design doc , but then discarded it, because we needed the full api version for the client. I wasn't sure then, if this was still a requirement, but it turned out, we need it for the client/tracker.
pkg/auth/event_policy.go
Outdated
strings.EqualFold(to.Ref.Name, resourceObjectMeta.GetName()) && | ||
strings.EqualFold(to.Ref.APIVersion, resourceAPIVersion) && | ||
strings.EqualFold(to.Ref.Kind, resourceGVK.Kind) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to match the full APIVersion and Kind or just kind + group ? what happens when there is a new version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we want to just have "Group + Kind" in the To
and Selector
API?
… provision TypeMeta field on resouces
…of allowed subjects
ab537e8
to
b8c12c8
Compare
/unhold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: creydr, pierDipi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test upgrade-tests |
Fixes #7985
Add library to support on AuthZ work
Proposed Changes
GetEventPoliciesForResource(eplister, gvk, meta)
returns a list of EventPolicies which apply for a given resource (gvk & meta)ResolveSubjects(resolver, eventPolicy)
returns a list of resolved subjects of an EventPolicySubjectContained(sub, allowedSubs)
to check if a given subject is part of a list of allowed subjects (includes*
matching)Requires knative/pkg#3056 to be merged
/hold