Add auth support for scorers#18699
Conversation
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
|
Documentation preview for 647712a is available at: Changed Pages (1)
More info
|
| perm = SqlScorerPermission( | ||
| experiment_id=experiment_id, | ||
| scorer_name=scorer_name, | ||
| user_id=user.id, |
There was a problem hiding this comment.
Q:
are we going to support granting permission to a group of users (e.g. I want to grant permission to all users for a scorer, but I don't want to add SqlScorerPermission item for every user, this way needs updates if new users are created.
There was a problem hiding this comment.
RBAC sounds very cool, but our auth system doesn't support it for any existing entities. Do I think we should eventually support it? YES. But I think that should be part of the 'bring auth directly into the tracking server as a core feature' sort of work. I do think we need this. Just not for this PR.
mlflow/server/auth/routes.py
Outdated
| CREATE_SCORER_PERMISSION = _get_rest_path("/mlflow/scorers/permissions/create") | ||
| GET_SCORER_PERMISSION = _get_rest_path("/mlflow/scorers/permissions/get") | ||
| UPDATE_SCORER_PERMISSION = _get_rest_path("/mlflow/scorers/permissions/update") | ||
| DELETE_SCORER_PERMISSION = _get_rest_path("/mlflow/scorers/permissions/delete") |
There was a problem hiding this comment.
Question:
Where are the permission validators for these endpoint path ?
These endpoint should only allow request from Administrator users, otherwise every user can grant permission to himself.
There was a problem hiding this comment.
Lines 727-730 have the permission endpoints that check validate_can_manage_scorer_permission so only admins and those with can_manage authority can modify.
| <tbody> | ||
| <tr> | ||
| <td>Register Scorer</td> | ||
| <td>`2.0/mlflow/scorers/register`</td> |
There was a problem hiding this comment.
| <td>`2.0/mlflow/scorers/register`</td> | |
| <td>`3.0/mlflow/scorers/register`</td> |
| </tr> | ||
| <tr> | ||
| <td>List Scorers</td> | ||
| <td>`2.0/mlflow/scorers/list`</td> |
There was a problem hiding this comment.
| <td>`2.0/mlflow/scorers/list`</td> | |
| <td>`3.0/mlflow/scorers/list`</td> |
| </tr> | ||
| <tr> | ||
| <td>Get Scorer</td> | ||
| <td>`2.0/mlflow/scorers/get`</td> |
There was a problem hiding this comment.
| <td>`2.0/mlflow/scorers/get`</td> | |
| <td>`3.0/mlflow/scorers/get`</td> |
| </tr> | ||
| <tr> | ||
| <td>Delete Scorer</td> | ||
| <td>`2.0/mlflow/scorers/delete`</td> |
There was a problem hiding this comment.
| <td>`2.0/mlflow/scorers/delete`</td> | |
| <td>`3.0/mlflow/scorers/delete`</td> |
| </tr> | ||
| <tr> | ||
| <td>List Scorer Versions</td> | ||
| <td>`2.0/mlflow/scorers/list-versions`</td> |
There was a problem hiding this comment.
| <td>`2.0/mlflow/scorers/list-versions`</td> | |
| <td>`3.0/mlflow/scorers/list-versions`</td> |
mlflow/server/auth/__init__.py
Outdated
| ) | ||
|
|
||
|
|
||
| def _get_permission_from_scorer_id() -> Permission: |
There was a problem hiding this comment.
_get_permission_from_scorer_name?
tests/server/auth/test_auth.py
Outdated
|
|
||
| _send_rest_tracking_post_request( | ||
| client.tracking_uri, | ||
| "/api/2.0/mlflow/scorers/permissions/create", |
There was a problem hiding this comment.
Can we use 3.0 for new permission endpoints?
There was a problem hiding this comment.
Thanks for the catch - one day I'll actually remember to be consistent about this for new routes ;)
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com> Signed-off-by: Tian Lan <sky.blue266000@gmail.com>
🛠 DevTools 🛠
Install mlflow from this PR
For Databricks, use the following command:
Related Issues/PRs
#xxxWhat changes are proposed in this pull request?
Adds a new auth reference to handle permissions associated with scorers via MLflow's auth feature.
For future work (considering that API keys will be associated with scorers) it is critical to ensure there is a mechanism to restrict via RBAC any scorers that may be scheduled to an Experiment.
How is this PR tested?
Does this PR require documentation update?
Release Notes
Is this a user-facing change?
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/tracking: Tracking Service, tracking client APIs, autologgingarea/models: MLmodel format, model serialization/deserialization, flavorsarea/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registryarea/scoring: MLflow Model server, model deployment tools, Spark UDFsarea/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflowsarea/gateway: MLflow AI Gateway client APIs, server, and third-party integrationsarea/prompts: MLflow prompt engineering features, prompt templates, and prompt managementarea/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionalityarea/projects: MLproject format, project running backendsarea/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/build: Build and test infrastructure for MLflowarea/docs: MLflow documentation pagesHow should the PR be classified in the release notes? Choose one:
rn/none- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/breaking-change- The PR will be mentioned in the "Breaking Changes" sectionrn/feature- A new user-facing feature worth mentioning in the release notesrn/bug-fix- A user-facing bug fix worth mentioning in the release notesrn/documentation- A user-facing documentation change worth mentioning in the release notesShould this PR be included in the next patch release?
Yesshould be selected for bug fixes, documentation updates, and other small changes.Noshould be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.What is a minor/patch release?
Bug fixes, doc updates and new features usually go into minor releases.
Bug fixes and doc updates usually go into patch releases.