-
Notifications
You must be signed in to change notification settings - Fork 55
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
Update verbs used to check SAR for users when k8s components are used #1050
Conversation
Update SAR checks for user permissions in webhook server to check whether a user can get/create/update/delete the resource rather than checking for '*' permissions. This is required as even if the user has the admin rolebinding, they do not have '*' permissions from the perspective of the cluster. Signed-off-by: Angel Misevski <[email protected]>
Codecov ReportBase: 50.98% // Head: 50.76% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1050 +/- ##
==========================================
- Coverage 50.98% 50.76% -0.23%
==========================================
Files 75 75
Lines 6470 6477 +7
==========================================
- Hits 3299 3288 -11
- Misses 2907 2923 +16
- Partials 264 266 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
Code looks good to me.
I followed the basic testing instructions on OpenShift 4.12:
- created a user without any permissions, and made a "test-project" namespace/project as the user
- The result of
oc auth can-i '*' pods -n test-project
wasno
- Created the DevWorkspace that uses a Kubernetes component containing a pod
- Checked I was able to also
oc get
,oc describe
,oc edit
andoc delete
the workspace
Webhooks server can manage load of doing 4 SAR checks instead of 1, and this doesn't overtax the cluster API
I may be wrong, but isn't this being tested by the fact the updated code is working as intended? (I didn't see any error logs regarding this on the webhook server or the controller manager)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, AObuchow, ibuziuk 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 |
The question is whether this becomes a problem when there are e.g. 1000 workspaces across 1000 namespaces. The webhook server is now making 5 SAR requests (4 SAR, 1 SSAR) instead of 2. However, we're (hopefully) careful to only check for RBAC when k8s components are added/modified, so it should still be a minimal amount of checks overall. |
What does this PR do?
Update SAR checks for user permissions in webhook server to check whether a user can get/create/update/delete the resource rather than checking for '' permissions. This is required as even if the user has the admin rolebinding, they do not have '' permissions from the perspective of the cluster.
What issues does this PR fix or reference?
Closes #1049
Is it tested? How?
Full testing would include verifying that
get
,create
,update
,delete
instead of*
However, the risks of issues with the points above is minimal:
*
permissions, it only performs theget
,create
,update
, anddelete
verbs.Basic testing:
admin
permissions but not*
permissions for pods:oc auth can-i '*' pods -n <namespace>
should print "no"PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che