Repository navigation
feat: approve deploys from a phone (device keys and phone sign-in) - #235
Open
ndbroadbent wants to merge 4 commits into
Open
ndbroadbent wants to merge 4 commits into
ndbroadbent wants to merge 4 commits into
Conversation
A phone can now hold a device key: a P-256 key in its Secure Enclave or StrongBox that signs a statement of one exact deploy approval request after Face ID or a fingerprint. - Enrolling stores the key unconfirmed and returns an 8-character code. Confirming it in Account Security needs the user's MFA, so a phone can't be added with a Google sign-in alone. Five wrong codes remove it. - Each key has a list of allowed actions (approve and reject deploy approval requests). A device key never signs in, opens no step-up window and doesn't count as MFA enrollment. - A challenge route issues a single-use, five-minute statement bound to the user, action and request. The gateway rebuilds it when the signature arrives and refuses it if anything changed. - The approval's audit entry records the signed statement, signature and public key, so anyone can verify it from the audit log alone. - Account Security shows a Phones card once a phone has enrolled.
The phone app signs in like the CLI (RFC 8252, PKCE), with its custom URL scheme instead of a loopback address. It returns through the CLI's existing Google redirect, so deployments register no new redirect URI. - POST /auth/mobile/start accepts only the app's redirect URI. The callback skips the browser binding and MFA steps for a mobile login and sends the app a single-use login code; POST /auth/mobile/complete redeems it with the code verifier for a 90-day mobile session. - Login codes are bound to the kind of client that started the login: a mobile code can't make a CLI session, or the reverse. - A mobile session reaches only the phone's routes (device keys, its own verification, deploy approvals). Everything else refuses it, including the rack proxy. - Until it verifies MFA it can only enroll its key or verify with one. Confirming the phone's key on the computer verifies the session that enrolled it. Later sign-ins verify by signing a statement of the new session with the confirmed key. Neither opens a step-up window, and approvals still need a signature of their own.
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Dec 3, 2026 3:03a.m. | Review ↗ | |
| Go | Dec 3, 2026 3:03a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
The phone app's sign-in now continues like a CLI login after Google: the same browser sheet shows the gateway's MFA
step (a TOTP code, a passkey or a security key), and only then returns to the app with its login code. The mobile
session starts verified, with a step-up window, and the app enrolls its device key inside that window.
That replaces the confirmation code the phone showed and the person typed into the web UI, and the device key
signature that verified later sign-ins:
- POST /device-keys needs a recent step-up; a key is usable as soon as it's stored
- device keys have no confirmation code, expiry or confirmed_at any more
- /device-keys/{id}/confirm and /auth/mobile/mfa/* are gone, with the mobile_session.verify statement
- the Phones card lists phones and removes them; the MFA page names a sign-in from the phone app
ndbroadbent
force-pushed
the
nathan/mobile-sign-in
branch
from
December 1, 2026 01:24
df2e29d to
8f93e07
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Approve and reject deploys from a phone. This PR holds the whole server side: device keys (previously #234) and the phone app's sign-in.
Device keys
The phone holds a device key: a P-256 key in its Secure Enclave or StrongBox. After Face ID or a fingerprint, the key signs a statement describing one exact deploy approval request.
POST /api/v1/device-keysneeds a recent MFA step-up. The phone app enrolls its key right after signing in, and the key is usable at once. A user exempt from MFA gets no step-up, so can't add a phone.device_key_not_accepted.POST /api/v1/deploy-approval-requests/:id/device-key-challengereturns a canonical JSON statement. It names the gateway, action, request, approver and key, and includes the app, commit, branch, PR, message, requester and CI token. It's single-use, expires after five minutes and is bound to that user, action and request. The phone sends its signature as inline MFA. The gateway rebuilds the statement from the current request and refuses the signature if anything changed.Phone sign-in
com.docspring.rackgateway:/auth/callback) where the CLI uses a loopback address.GET /api/v1/auth/mobile/startsends the sign-in sheet to Google. Google returns to the existing/api/v1/auth/cli/callback, so deployments don't add a redirect URI in the Google Cloud console. Acli_login_states.clientcolumn marks a login ascliormobile./api/v1/auth/cli/returnsends the app a single-use login code.POST /api/v1/auth/mobile/completeredeems it with the PKCE verifier. Each code only redeems for the kind of client that started its login.mobilesession with MFA verified and a fresh step-up, so the app can enroll its key straight away.The mobile session
info, MFA status, listing and enrolling device keys, and deploy approval requests (list, read, get a challenge, approve, reject).mobile_session_route, and the rack proxy refuses it outright.Docs:
user-guide/mfa/phone-approvals.The iPhone app that uses this is in
mobile/ioson a separate branch. Outbound webhooks for approval events come later.Testing
auth/mfa/device_keys_test.gocovers:handlers/device_key_approval_test.gogoes through the MFA middleware:handlers/auth_mobile_test.gocovers the full sign-in against a fake identity provider:routes/mobile_session_test.gogoes through the full router:db/mobile_session_test.gochecks that login codes are bound to their client.