Repository navigation
fix(console): send the device authorization purpose from /link (desktop sign-in) - #1493
Conversation
Darkbloom Desktop sign-in failed with "authorization purpose does not match this code". The live coordinator (darkbloom-platform#23) issues desktop_account device codes and requires approvals to name that purpose, but console.darkbloom.dev is still served from this retained console, whose /link page ignores ?purpose=desktop_account and posts the code without a purpose. Port the link page from darkbloom-platform#23: read the purpose from the URL, send purpose "desktop_account" or "provider" with the approval, and show desktop sign-in wording. The approval proxy already forwards the body unchanged; a contract test now covers the purpose field. Provider linking is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Threat model review — advisoryReviewed head Review not completed for this head. Previous findings are superseded, not confirmed resolved. Reviewers: anthropic/claude-sonnet-5.5: first pass completed; anthropic/claude-opus-5.5: selected depth completed (3 batches); openai/gpt-6.1-sol: selected depth completed (3 batches) MEDIUM: Desktop-scope check runs only after approval, so a coordinator that ignores `purpose` still links the deviceconsole-ui/src/app/link/DeviceLinkForm.tsx:62 · A-008, TB-002 `handleSubmit` posts `purpose` to `/api/device/approve` and checks `data.purpose` only after the coordinator has returned success (line 62). The server-side approval has already happened by then. If the coordinator build is older or lacks strict purpose enforcement, it ignores the field. A victim opening `/link?purpose=desktop_account` with an attacker-supplied provider-flow code would then link the attacker's provider to the victim's account. The UI shows 'did not confirm read-only desktop access, try again after it is updated', which wrongly implies nothing was granted. This matters for A-008 and TB-002 because a hostile provider could receive the account's earnings assignment. Fix: gate rollout on coordinator enforcement, and tell the user the approval may have taken effect and must be revoked. The coordinator should reject mismatched purposes before approving, and it must treat a missing `purpose` as provider-only. Raised by: anthropic/claude-sonnet-5.5 LOW: New 30-day read-only desktop credential and its scope claims are not covered by the threat modelconsole-ui/src/app/link/DeviceLinkForm.tsx:217 · A-008 The UI now tells users that `desktop_account` approval grants 30-day access to view Macs and earnings and cannot start providers, manage API keys or withdraw funds (line 217). The purpose is also taken from a URL query parameter (`page.tsx` line 8), so a crafted link can change the page's wording and the purpose sent. The enforcement lives in the coordinator, which is outside this repo. A-008 covers only provider tokens. The new token type, its lifetime, scope enforcement, revocation, and the phishing path through `?purpose=` have no asset, threat or mitigation entry. Add these to the threat model, and verify that the server enforces the purpose binding and the scope limits the UI promises. Raised by: anthropic/claude-sonnet-5.5 Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Coverage: 28/28 source units; cross-file integration complete. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned. Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens. Saved findings and earlier report · Historical findings are not confirmed resolved. Bedrock: 10 request(s), 304720 input / 11149 output tokens; 0 request(s) with unknown usage. OpenRouter backup used 0 time(s). Dollar amounts above cover OpenRouter only; AWS billing is reconciled separately. |
* chore(release): prepare provider 0.10.1 Set ProviderCore.version to 0.10.1 and render the v0.10.1 changelog entry from the 13 fragments added since v0.10.0: the GLM-5.3-Flash and Nemotron 3.5 Super OpenRouter readiness work (#1561, #1560) and the many-file download progress display (#1558), plus already-merged installer, sign-in and release-note fixes (#1505, #1493, #1482). Order the entries by theme behind an upgrade and rollout section. Logprobs are deferred, so the native-engine entry keeps the typed refusal and calls the GLM logprob code disabled groundwork. Drop the forced-tool-choice refusal that the GLM JSON and forced-choice entry supersedes, and clarify the GLM startup savings and the wired-limit notice. Mark v0.10.0 as published on 2026-10-23. Record in the provider release runbook that darkbloom-platform#411 must be deployed before tagging, that no catalog row gains the logprobs capability for 0.10.1, and that #1561 re-pins mlx-swift-lm to the #340 squash commit before it merges. No tag, registration, upload or deployment is performed. * chore(release): render the desktop app entries into provider 0.10.1 The desktop app (#1518) merged to master after this preparation was rendered, so its six changelog fragments were still pending. Render them verbatim into the v0.10.1 entry and remove them: the desktop control API and hardware report ship in the provider CLI. Note in the rollout notes and the runbook that the provider release does not build, sign or publish the Electron desktop app, whose public distribution still needs a signed, notarized build and an update feed. * chore(release): render the Autopilot entry into provider 0.10.1 Autopilot placements, downloads and busy reasons (#1565) merged to master after the desktop update. Render its fragment into the v0.10.1 entry and remove it, correcting "startup is not slower": with consent, start first fetches the catalog, waiting up to 10 s. Add rollout notes: changes apply only to Macs with saved consent; the wider selected_models also counts toward reward qualification, approval counts and operation victims on the current coordinator; one reconnect after start; holds, adopted routing and downloads need darkbloom-platform#439. --------- Co-authored-by: Jonathan Spangler <5055076+jonathan308@users.noreply.github.com>
Summary
Darkbloom Desktop sign-in always fails. The approval page at
console.darkbloom.dev/linkshows "authorization purpose does not match this code".Root cause: the live backend and the live console are deployed from different repositories.
api.darkbloom.devcomes from darkbloom-platform, which shipped desktop sign-in in darkbloom-platform#23. It issuesdesktop_accountdevice codes and rejects any approval whosepurposedoesn't match the code.console.darkbloom.devis still served from this repository's retainedconsole-ui. darkbloom-platform's console docs say: "No hosting or live endpoint is switched."/linkpage predates v0.3.8: Not able to download FLUX.2 Klein 4B, getting "The requested URL returned error: 404" #23. The desktop app correctly opens…/link?purpose=desktop_account, but the page ignores the parameter and posts{ user_code }with no purpose, so the coordinator refuses it.This PR ports #23's link page into the console that is actually live. The pre-#23 platform versions of
page.tsxandDeviceLinkForm.tsxare byte-identical tomaster's, so the change applies exactly.Before / After
flowchart LR subgraph Before["Before"] direction TB B1(["Desktop app: Sign in"]):::user --> B2["coordinator (platform #23): desktop_account code"]:::code B2 --> B3["console /link?purpose=desktop_account<br/>(retained copy) posts { user_code }"]:::bad B3 --> B4(["400: authorization purpose does not match this code"]):::bad end subgraph After["After"] direction TB A1(["Desktop app: Sign in"]):::user --> A2["coordinator: desktop_account code"]:::code A2 --> A3["/link reads ?purpose, posts<br/>{ user_code, purpose: desktop_account }"]:::fix A3 --> A4(["Approved: “Signed In!” · app receives its token"]):::good end classDef user fill:#1f2937,stroke:#93c5fd,color:#f9fafb classDef code fill:#312e81,stroke:#a5b4fc,color:#eef2ff classDef bad fill:#7f1d1d,stroke:#fca5a5,color:#fef2f2 classDef fix fill:#065f46,stroke:#6ee7b7,color:#ecfdf5 classDef good fill:#14532d,stroke:#86efac,color:#f0fdf4Legend: blue = user action, indigo = unchanged code path, red = defect, green = changed code / fixed outcome.
Changes
Files ported from darkbloom-platform#23 (
d7c836b71):console-ui/src/app/link/page.tsx: reads?purpose=desktop_accountand passes the purpose to the form.console-ui/src/app/link/DeviceLinkForm.tsx:purposewith the approval (desktop_account, orproviderfor ordinary links);console-ui/__tests__/device-link.test.tsx(new),pages.test.tsx: the desktop and provider flows.console-ui/__tests__/account-proxy-contracts.test.ts: the/api/device/approveproxy forwards thepurposefield unchanged.Docs and changelog:
docs/architecture/components/console-ui.md: updated the/linkand approval-proxy rows.changelog.d/console-desktop-signin-purpose.md: changelog fragment.Compatibility: ordinary provider codes are approved with
purpose: "provider", which the coordinator accepts as before. The approval proxy already forwards the body as text, so no route changes are needed.Test plan
cd console-ui && npx vitest run __tests__/device-link.test.tsx __tests__/pages.test.tsx __tests__/account-proxy-contracts.test.ts: 22 passed. With thesrcchange reverted, 5 fail.npx vitest run(whole console): 117 files, 910 tests passed.npx eslint src/app/link: clean.npx tsc --noEmit: the only error is in the untouchedsrc/components/payouts/GlobalWithdrawModal.test.tsx. It reproduces onmasterand is unrelated.python3 scripts/changelog.py check,make docs-impact-check BASE=origin/master.Components touched
console.darkbloom.dev)Notes for reviewers
console.darkbloom.devhosting to the platform console, which already has this change.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.