Skip to content

fix(console): send the device authorization purpose from /link (desktop sign-in) - #1493

Merged
Gajesh2007 merged 1 commit into
masterfrom
fix/console-desktop-signin-purpose
Oct 23, 2026
Merged

Gajesh2007 merged 1 commit into
masterfrom
fix/console-desktop-signin-purpose

Conversation

@jonathan308

@jonathan308 jonathan308 commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Darkbloom Desktop sign-in always fails. The approval page at console.darkbloom.dev/link shows "authorization purpose does not match this code".

Root cause: the live backend and the live console are deployed from different repositories.

  • The coordinator at api.darkbloom.dev comes from darkbloom-platform, which shipped desktop sign-in in darkbloom-platform#23. It issues desktop_account device codes and rejects any approval whose purpose doesn't match the code.
  • console.darkbloom.dev is still served from this repository's retained console-ui. darkbloom-platform's console docs say: "No hosting or live endpoint is switched."
  • This copy's /link page 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.tsx and DeviceLinkForm.tsx are byte-identical to master'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:#f0fdf4
Loading

Legend: 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_account and passes the purpose to the form.
  • console-ui/src/app/link/DeviceLinkForm.tsx:
    • sends purpose with the approval (desktop_account, or provider for ordinary links);
    • shows desktop sign-in wording;
    • treats an approval response with the wrong purpose as an error.
  • 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/approve proxy forwards the purpose field unchanged.

Docs and changelog:

  • docs/architecture/components/console-ui.md: updated the /link and 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 the src change 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 untouched src/components/payouts/GlobalWithdrawModal.test.tsx. It reproduces on master and is unrelated.
  • python3 scripts/changelog.py check, make docs-impact-check BASE=origin/master.
  • After deploy: Darkbloom Desktop → Sign in → Continue in browser → enter the code → "Signed In!", and the app shows the account. I found this by reproducing the error with the signed desktop preview against the live service.

Components touched

  • console-ui (retained; serves console.darkbloom.dev)
  • docs

Notes for reviewers

  • New console development belongs in darkbloom-platform, and this PR is a hotfix for the copy that is live. The long-term fix is switching console.darkbloom.dev hosting to the platform console, which already has this change.
  • Opened as a draft, for the console owners to confirm that hosting is still served from this repository before merging.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

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>
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Ready Ready Preview Oct 14, 2026 9:31pm UTC
d-inference-console-ui-dev Ready Ready Preview Oct 14, 2026 9:31pm UTC
d-inference-landing Ready Ready Preview Oct 14, 2026 9:31pm UTC
darkbloom-status Ready Ready Preview Oct 14, 2026 9:31pm UTC
eigen-homepages-darkbloom Ready Ready Preview Oct 14, 2026 9:31pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head cb38bfc44895 against base 329bdd682dc3.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
Final reviewer requests further review; independent human review required

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 device

console-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 model

console-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.

@Gajesh2007
Gajesh2007 merged commit b6eb635 into master Oct 23, 2026
27 checks passed
@Gajesh2007
Gajesh2007 deleted the fix/console-desktop-signin-purpose branch October 23, 2026 19:30
@jonathan308 jonathan308 mentioned this pull request Oct 23, 2026
5 of 8 tasks
Gajesh2007 pushed a commit that referenced this pull request Oct 23, 2026
* 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>

This branch was successfully deployed

5 active deployments
Preview – d-inference-console-ui-dev — cb38bfc4 Deployed Oct 14, 2026 by vercel[bot]
Preview – d-inference-landing — cb38bfc4 Deployed Oct 14, 2026 by vercel[bot]
Preview – d-inference — cb38bfc4 Deployed Oct 14, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — cb38bfc4 Deployed Oct 14, 2026 by vercel[bot]
Preview – darkbloom-status — cb38bfc4 Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants