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

On-prem Pro tenants: secure enrollment, CSRF tokens and cross-domain authorization flow #3264

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

stefannica
Copy link
Contributor

@stefannica stefannica commented Dec 13, 2024

Describe changes

This PR packs together several improvements that allow self-hosted zenml servers to be enrolled as ZenML Pro tenants and makes it easier to connect the client to a self-hosted ZenML Pro tenant server and control plane.

Some highlights:

  1. allow a custom ZenML Pro API URL to be used with zenml login, zenml logout and zenml server list via a --pro-api-url argument (e.g. zenml login --pro-api-url https://staging.cloudapi.zenml.io).
  2. the ZenML server details (e.g. version, deployment type, control plane and dashboard URLs) are extracted straight from the server's API before connecting to it. Used in combination with the previous change, this allows multiple tenants belonging to multiple Pro control planes to be managed at the same time.
  3. formalized the "zenml pro server configuration" and added more attributes to it. These settings are also used to override some of the regular server configuration settings if for ZenML Pro servers. The long-term vision is to have these attributes be re-configured dynamically by the ZenML Pro control plane during enrollment and later on during updates.
  4. the helm chart has also been updated to formalize zenml pro configuration values. This, used in combination with the previous feature, significantly reduces the amount of helm deployment settings that need to be set for self-hosted ZenML Pro tenants.
  5. implemented the tenant authorization flow and CSRF token mechanisms described in https://github.com/zenml-io/zenml-cloud-api/pull/303
  6. cache the server info in the REST zen store, as this information is not expected to change over the lifetime of a zenml client instance and it makes the client somewhat faster.

Pre-requisites

Please ensure you have done the following:

  • I have read the CONTRIBUTING.md document.
  • 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.
  • IMPORTANT: I made sure that my changes are reflected properly in the following resources:
    • ZenML Docs
    • Dashboard: Needs to be communicated to the frontend team.
    • Templates: Might need adjustments (that are not reflected in the template tests) in case of non-breaking changes and deprecations.
    • Projects: Depending on the version dependencies, different projects might get affected.

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

coderabbitai bot commented Dec 13, 2024

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added internal To filter out internal PRs and issues enhancement New feature or request labels Dec 13, 2024
Copy link

socket-security bot commented Dec 13, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
pypi/[email protected] unsafe Transitive: environment, eval, filesystem, network, shell +76 77.9 MB
pypi/[email protected] environment, eval, filesystem, network, shell Transitive: unsafe +72 19.7 MB John.Kurkowski

View full report↗︎

@stefannica stefannica force-pushed the feature/grow-171-cross-site-auth branch from 2d20c2e to 33af3ce Compare December 20, 2024 09:03
Copy link
Contributor

E2E template updates in examples/e2e have been pushed.

@stefannica stefannica force-pushed the feature/grow-171-cross-site-auth branch from 81af11a to accbe6f Compare December 20, 2024 12:29
Copy link
Contributor

E2E template updates in examples/e2e have been pushed.

@stefannica stefannica changed the title Implement cross-site external authentication protected by CSRF tokens Secure enrollment, CSRF tokens and cross-domain authorization flow for un-managed tenants Dec 27, 2024
@stefannica stefannica changed the title Secure enrollment, CSRF tokens and cross-domain authorization flow for un-managed tenants On-prem Pro tenants: secure enrollment, CSRF tokens and cross-domain authorization flow Dec 27, 2024
Comment on lines -263 to -265
external_access_token = request.cookies.get(
config.external_cookie_name
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: the dependency on the external cookie can be completely removed here ONLY if the dashboard always uses the tenant authorization flow, even for same-site tenants.

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 run-slow-ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants