Repository navigation
feat(mfa): device keys for approving deploys from a phone - #234
Closed
ndbroadbent wants to merge 2 commits into
Closed
ndbroadbent wants to merge 2 commits into
ndbroadbent wants to merge 2 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.
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Nov 30, 2026 1:26p.m. | Review ↗ | |
| Go | Nov 30, 2026 1:26p.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.
Member
Author
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.
Summary
Adds the gateway side of approving and rejecting deploys from a phone. 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. The phone app itself is a separate project; this PR only adds what it needs on the server.
How it works
Enrollment:
POST /api/v1/device-keysstores the key unconfirmed and returns an 8-character code for the phone to show. The person types the code into Account Security → Phones (POST /api/v1/device-keys/:id/confirm), and confirming asks for their MFA every time. So a phone can't be added with a Google sign-in alone. The code expires after 15 minutes, and five wrong codes remove the key.Scope: each key has a stored list of allowed actions, currently approving and rejecting deploy approval requests. A device key:
Every other MFA route refuses it with
device_key_not_accepted.Signing:
POST /api/v1/deploy-approval-requests/:id/device-key-challengereturns a canonical JSON statement. The statement:The phone sends its signature as inline MFA (
<session>.device_key.<proof>). The gateway rebuilds the statement from the current request and refuses the signature if anything has changed since.Audit: the approve and reject audit entries record the signed statement, the signature and the public key. Anyone can verify an approval from the audit log alone.
Reset: an admin MFA reset also removes the user's device keys.
Docs:
user-guide/mfa/phone-approvals.Not in this PR
Testing
internal/gateway/auth/mfa/device_keys_test.gocovers:internal/gateway/handlers/device_key_approval_test.gosends requests through the MFA middleware to cover: