Repository navigation
CLI: doctor --mcp sends the API key only to a Studio that proves its identity - #14178
Conversation
|
@codex review |
|
@codex security 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. |
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. |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. Keep them coming! 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". |
Hardening from the latest security scan, in
unsloth doctor --mcp(added in #14077).Problem. When
UNSLOTH_STUDIO_URLis not set, the MCP doctor finds Unsloth Studio by probing local ports for the public/api/healthanswer, then sendsUNSLOTH_API_KEYas a bearer token to/api/inference/loaded-modelsand/mcp/./api/healthis public, so anything listening on that loopback port can answer it. On a shared machine, another local user listening on 127.0.0.1:8888 while Studio is stopped would receive the owner's API key.unsloth chatandunsloth startalready guard against this withverify_studio_identity(an HMAC challenge only this machine's Studio can answer) before sending a secret; the doctor skipped it.Change (
unsloth_cli/commands/mcp.py). For an auto-discovered loopback server, the doctor callsverify_studio_identityfirst. If it fails, the key is not sent to either endpoint and the doctor reportsAPI key: set, not sentwith a hint to setUNSLOTH_STUDIO_URL.UNSLOTH_STUDIO_URLis still trusted as before (the user named the server), which keeps SSH-tunnel setups working.Tests (
unsloth_cli/tests/test_doctor_mcp.py): a new case where the found server fails the identity check asserts noAuthorizationheader reaches it, and thatUNSLOTH_STUDIO_URLstill sends the key; plus the new hint. Both fail on main and pass here. The fullunsloth_cli/testssuite passes (2095 passed).