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

Cloud RBAC #1999

Merged
merged 123 commits into from
Nov 24, 2023
Merged

Cloud RBAC #1999

merged 123 commits into from
Nov 24, 2023

Conversation

schustmi
Copy link
Contributor

@schustmi schustmi commented Oct 30, 2023

Describe changes

This PR introduces changes to enable RBAC for all server endpoints.

RBAC

To check whether a user is allowed to perform an action on a resource, we verify that either

  • the user is the owner of the resource (e.g. created the stack that he wants to read/update/delete)
  • the user has an assigned role that gives them permission to perform the action. This is done using any concrete implementation of the zenml.zen_server.rbac.rbac_interface.RBACInterface interface.

Dehydration

Some of our response models contain other response models in some of their attributes. In some cases, users might have access to read the parent model but not the child models contained within it. To address this, we "dehydrate" any response model and redact information from child models which the user is not allowed to access.

Service accounts

Service accounts are currently stored in the server database which makes them incompatible with the Cloud RBAC backend (which requires an entry in the cloud user table). For this reason, service accounts currently are excluded from the RBAC and have full permissions.

Some additional changes that needed to be implemented

  • Sharing of stacks, stack components and service connectors was removed. In case of overlapping entity names which are required to be unique, the owner id is appended as the suffix.
  • Roles and teams were removed. This includes any kind of authorization on server endpoints when RBAC is disabled.
  • The default stack and stack components are now created server-side. Additionally, there is just a single default stack per server and not one per user. This was necessary as some users might not have permissions to even create a stack, but the client code requires a working active stack in lots of places.
  • To make caching less error-prone when using a shared local (e.g. default) stack, the client ID is not included in the cache key for local artifact stores.

Pre-requisites

Please ensure you have done the following:

  • I have read the CONTRIBUTING.md document.
  • If my change requires a change to docs, I have updated the documentation accordingly.
  • If I have added an integration, I have updated the integrations table and the corresponding website section.
  • I have added tests to cover my changes.
  • I have based my new branch on develop and the open PR is targeting develop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (add details above)

Copy link
Contributor

@stefannica stefannica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to land !

Copy link
Contributor

@bcdurak bcdurak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, amazing changes. It is great to see all of our previous discussions come alive in such an elaborate manner. I left a few comments, hope it helps.

I love the clean up as well ❤️

src/zenml/models/__init__.py Show resolved Hide resolved
src/zenml/zen_server/rbac/endpoint_utils.py Show resolved Hide resolved
src/zenml/zen_server/rbac/zenml_cloud_rbac.py Outdated Show resolved Hide resolved
src/zenml/zen_server/rbac/zenml_cloud_rbac.py Outdated Show resolved Hide resolved
src/zenml/zen_server/rbac/endpoint_utils.py Show resolved Hide resolved
src/zenml/zen_server/rbac/models.py Show resolved Hide resolved
src/zenml/zen_server/rbac/models.py Show resolved Hide resolved
Copy link
Contributor

E2E template updates in examples/e2e have been pushed.

Copy link
Contributor

E2E template updates in examples/e2e have been pushed.

@schustmi schustmi merged commit 5f5dc53 into develop Nov 24, 2023
29 checks passed
@schustmi schustmi deleted the feature/rbac branch November 24, 2023 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internal To filter out internal PRs and issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants