Repository navigation
Studio: managed accounts use the server's own HF endpoint for recipe seeds - #14187
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 857907deff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| from core.data_recipe.service import _require_public_provider_endpoint | ||
| _require_public_provider_endpoint(typed) |
There was a problem hiding this comment.
Validate redirect targets before fetching the seed
A managed user can supply an attacker-controlled public HTTPS endpoint, which passes this check, and have it redirect the subsequent /validate request to a loopback, LAN, or cloud-metadata URL. The seed reader uses HfFileSystem, whose huggingface_hub HTTP client follows redirects, while validation runs in the API process without install_public_egress_guard; therefore the new check does not prevent the SSRF it is intended to close. Apply the public-address policy to every redirect/connection or use a guarded transport for the API-side seed fetch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed: HfFileSystem follows a 302 from the typed endpoint to an internal one, so checking the typed address is not enough. Fixed in 4309f3e: a managed account may only use this server's own HF endpoint (blank, the UI default, or the same URL); any other typed endpoint is refused with 403 before anything is fetched. The owner is unchanged. Tests cover private, metadata and public HTTPS endpoints with the private-URL setting on and off; end to end through the validate route, a public endpoint that redirects to loopback now gets 403 and neither server is contacted.
…h follows redirects [skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
## Summary Main is over the startup bundle budget again, by 17 B raw, so `Frontend build + bundle sanity` fails on every PR based on it: ``` over the startup budget: raw 6665.9 KB > 6665.9 KB (main at 551dc28) ``` #14168 reset both limits to the measured build plus a 160 B raw / 189 B transfer margin. #14190 (open //host links as web links) then added 177 B raw / 52 B transfer to the eager startup chunks. It merged while its own bundle check was still queued, so the raise never happened. ## Cause `studio/frontend/src/lib/open-link.ts` is the shared link opener, and the eager shell imports it. #14190 adds leading/trailing control-character trimming and `//host` (scheme-relative) link handling there (+16 lines). That is real growth with no lazy home: the opener is needed from the first screen. #14187, the other commit since the reset, changes no frontend code. ## Change - **`check-bundle-budget.ts`:** a BUDGET comment entry for #14190, and both limits moved to the measured build plus the same margin: - `rawBytes`: 6,825,885 -> 6,826,062. - `transferBytes`: 2,054,261 -> 2,054,313. ## Testing One machine and build, Node 24, exact byte totals from the budget script, 95 chunks throughout. CI has matched this machine to the byte on every earlier budget change. | tree | raw B | transfer B | |---|---|---| | `4dc8bf0bd2` (after #14168, no frontend change since) | 6,825,725 | 2,054,072 | | main `551dc28123` (+ #14190, #14187) | 6,825,902 | 2,054,124 | - **Main against the old limits:** `over the startup budget: raw 6665.9 KB > 6665.9 KB`. - **With this change:** `within budget (0.2 KB transfer, 0.2 KB raw to spare)`.
Fix from a re-check of the security scan backlog. Nothing changes for the owner, Desktop, the CLI or notebooks.
Problem. A data recipe's Hugging Face seed node accepts a typed
endpoint._resolve_seed_endpoint(routes/data_recipe/jobs.py) fills in the server's own endpoint when it is blank and otherwise leaves the typed one alone, andvalidate_recipe_accesschecks the seed's token and paths but not its endpoint.POST /api/data-recipe/validatethen runs Data Designer's validation in the API process, which reads the seed from that endpoint. The public-only egress guard (install_public_egress_guard) runs only in the recipe job worker, not in the API process.So on a multi-account install, a managed account could make the Studio server send GET requests to loopback, LAN or cloud metadata addresses of its choosing, and read back whether each host and port answered from the validation error. Managed accounts are otherwise limited to public addresses for providers, MCP, recipes and (since #14091) Hub dataset cards.
Change. A managed account may only use this server's own Hugging Face endpoint for an HF seed: blank (the UI default, resolved to
HF_ENDPOINTas before) or the same URL typed explicitly. Any other typed endpoint is refused with 403 before anything is fetched. Both callers (validate and job start) go through_resolve_seed_endpoint.Evidence. End to end with data-designer 0.5.4 and a loopback server recording requests, the real validate route called as a managed account:
http://127.0.0.1:<port>/internalGET /internal/api/datasets/...; error returns the status and URLTests (
tests/test_managed_provider_url_policy.py): a managed account's private, metadata and public HTTPS seed endpoints are refused, with the owner's private-URL setting on and off (12 cases, all fail on main); blank, the server's own endpoint, and any endpoint for the owner still resolve as before. The data recipe and account suites pass (434 passed, 20 skipped).