-
Couldn't load subscription status.
- Fork 424
Implement support for references in permission claims #3670
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
Conversation
|
Skipping CI for Draft Pull Request. |
The old code would loop through all bound claims and for each matching (group/resource) claim it would try to find the first (!) matching exported claim. And then check the verbs. If no exported claim is found, the set of allowed verbs is empty, so the HasAny() check can never succeed. Hence if no exported claim exists, we do not even have to check the verbs. This commit improves the loop by comparing all bound claims against all (!) exported claims (with the matching GRI) and skipping any guaranteed-false checks if no exported claim is found. This loop now is ready to be extended to check for references, too. On-behalf-of: @SAP [email protected]
…dynrestmapper and dynclusterclient The DDSIF is metadata-only and cannot be used to get informers for bound resources (i.e. those resources that would be allowed to be named in permissionClaim.selector.references[].group/resource (this validation has not been implemented yet in this branch)), so as a last resort, this approach will just fetch the objects directly. This commit is a WIP since the remaining code for the reference matching hasn't been done yet. On-behalf-of: @SAP [email protected]
bdd0a7c to
5255489
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
I pushed my branch into this repository, but cannot change this PR and am loo tazy to create a new PR just to instantly close it. 😁 |
Summary
This PR attempts to implement reference-based access to claimed resources in the apiexport virtual workspace. Where instead of the APIBinding directly naming the (for example) allowed Secrets to access, it would instead say "allow all secrets that are mentioned in this JSONPath in the following other resources". Think of allowing all Secrets that are mentioned in
spec.secretNamein Certificate objects.The idea is to handle most of the access control by extending the permissionclaim labeler, which will calculate for each and every claimed object, whether that object should be included in an APIExport's virtual workspace. The resullt ofthat calculation is then stored as a label and this label is silently injected into requests to the apiexport virtual workspace, thereby filtering the objects down to the desired set.
With
matchAll, this is easy, just label all the claimed objects. For label selectors this is also still somewhat easy because for calcualting if one object should be labeled, only that one object needs to be looked at.However for references, suddenly to calculate the label for objects of resource X, we need to list all objects of resource Y (in full, not just their metadata) and evaluate JSONPaths against all of them to determine the set of allowed object names. This means the labels will need to be recalculated for all X objects whenever any Y object changes.
In effect that means kcp would need to either (like in this primitive unfinished PR) list all the Y objects dynamically or keep runtime informers around for basically all bound resources. And changes to one object can suddenly balloon into label changes on many objects (this was already true with APIBindings, but those change much less frequently than the "interesting" workload resources that users bound into their workspaces), and also changes to a claimed object (resource X) will force kcp to re-evaluate all Y objects.
None of this touches yet on the authorization that would need to happen for when objects are created (I am not sure when a new object is labeled and when authz for that action happens).
Since we currently have no strong usecase for this feature and fear the implications in terms of complexity and performance, we abandoned this approach for now.
What Type of PR Is This?
/kind feature
Related Issue(s)
Fixes #3409
Release Notes