Skip to content

app/: visualci login's device-code sign-in (sc-8900) - #67

Merged
ndbroadbent merged 6 commits into
mainfrom
laravel-device
Dec 2, 2026
Merged

ndbroadbent merged 6 commits into
mainfrom
laravel-device

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Part of sc-8900 (the auth side of the Laravel Rust port). Stacked on #66.

Ports visualci login's device-code sign-in, which works like RFC 8628.

For the CLI (the api group: no session, no CSRF):

  • POST /api/v1/device/code returns a code pair: a 40-character device code, which is stored as a hash, and a user code such as KQHT-WMRP, using letters that are hard to mistake for each other. The pair lasts ten minutes.
  • POST /api/v1/device/token answers pending, denied, expired or approved. An approved code gives a new personal token, once: the code is claimed in one statement. The person also gets the security notice.

For the person (the web group):

  • GET /api/ui/device/{code} shows what's asking to sign in.
  • POST /api/ui/device/{code} with {approve} approves or denies it.
  • Codes are read the way people type them: any case, with or without the dash.

The same paths and JSON as today's. make_user_token is now shared with the tokens page.

Tests: app/tests/device.rs (2 tests) and a unit test, passing on docspring-dev; clippy is clean.

@visualci-com

visualci-com Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #414 · 333 unchanged · no changes

This PR vs base: 22 changed, 2 added since #233, across 6 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

@ndbroadbent
ndbroadbent force-pushed the laravel-device branch 2 times, most recently from deab9a3 to aebe17d Compare December 2, 2026 14:36
@ndbroadbent
ndbroadbent force-pushed the laravel-me branch 2 times, most recently from 511051b to 612290f Compare December 2, 2026 15:28
@ndbroadbent
ndbroadbent force-pushed the laravel-device branch 2 times, most recently from 30c8086 to fd6a9da Compare December 2, 2026 16:01
@ndbroadbent
ndbroadbent force-pushed the laravel-me branch 2 times, most recently from c62e65e to 3fb0ee1 Compare December 2, 2026 22:37
@ndbroadbent
ndbroadbent changed the base branch from laravel-me to main December 2, 2026 22:50
…vice/code and /device/token for the CLI (device code stored hashed, ten minutes, one token once, claimed in one statement), GET/POST /api/ui/device/{code} for the person to approve or deny (codes read as typed); a security notice when the CLI signs in
…isualCI command-line sign-in' label, where and when it was asked for and 'only approve this if you just ran visualci login', with the name the CLI sent as a detail; at most ten codes per address in ten minutes (429); expired codes deleted daily (VISUALCI_DEVICE_PRUNE_HEARTBEAT); a poll within the interval gets slow_down; the code is claimed and its token made in one transaction; the client's address comes through TRUSTED_PROXIES
@ndbroadbent
ndbroadbent merged commit 6a717c9 into main Dec 2, 2026
11 checks passed
@ndbroadbent
ndbroadbent deleted the laravel-device branch December 2, 2026 23:20
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.

1 participant