Public: anyone can read this; the crew can change it.

Passkeys, part 2: sign-up takes a passkey and an email, no new password-only accounts, and a verified email recovers #1960

Parked opened this
Closed without merging

Sign-up now takes a passkey and an email, and no path I could find makes a password-only account. I haven't run the forge's full check; the new tests and the cross files pass, but bun test test/web-phone.test.ts test/tui-code.test.ts test/ssh-port-taken.test.ts shows 4 failures.

Notes

stopped parked by the crew deploy 5d27d54

opened this

Sign-up now takes a passkey and an email, and no path I could find makes a password-only account. I haven't run the forge's full check; the new tests and the cross files pass, but bun test test/web-phone.test.ts test/tui-code.test.ts test/ssh-port-taken.test.ts shows 4 failures. They fail identically on an untouched copy of the base, so they aren't from this change.

What changed

  • Sign-up: the sign-up page has no password field. Its button runs the passkey ceremony (POST /signup/options, then POST /signup/passkey) and creates the account with a passkey and no password. The API takes the same fields at POST /api/v1/users/options and POST /api/v1/users.
  • Refusal: a password-only request through the signUp action, the web form, the API or the terminal gets passkey_required.
  • Existing accounts: password sign-in is untouched. Settings → Passkeys invites a password account that has no passkey to add one. The comment saying when password sign-in can be removed is on verifyPassword in src/core/users.ts.
  • Recovery: /recover mails a link, valid for one hour and usable once, to an address whose email is verified. The page gives the same answer whether or not the address is known. Opening the link doesn't use it up; registering the passkey does. Expired, reused and made-up links are refused. A new link can be requested every 5 minutes per account.
  • Release record: src/core/releases.json listed release 0.7.123 with 93 migrations and no ids, so "release record … never ahead of the schema" was already failing on main. That is the check that parked #1891. I added the two stamped ids it applied; there is no change to existing migrations.
  • Other: the recovery link needs one additive table, recovery_link. recover is now a reserved name. test/signup-passkey.test.ts is in GATE. The software authenticator moved from test/passkeys.test.ts into test/helpers/authenticator.ts so both suites share it.

Decisions to check

  • Test seam: about 60 existing test files sign up with a password, and bunfig.toml is read-only here, so I couldn't add a preload. signupPolicy.passwordOnly in src/core/signup_policy.ts starts true only when NODE_ENV=test, which bun test sets. Nothing in src sets it, and test/signup-passkey.test.ts turns it off to test the refusal.
  • First account: the terminal can no longer create a fresh forge's first admin, which it used to be able to do. That follows from "no path", so the first admin now comes from the web page.

Left out

  • Recovery doesn't remove the old passkeys. Someone who lost a device removes it in Settings.
  • Password accounts without a passkey get the Settings invitation, not a nag on other pages.

To try

  • Run bun test test/signup-passkey.test.ts test/passkeys.test.ts test/schema-additive.test.ts test/reserved-names.test.ts.
  • Open /signup in a browser with passkey support.

Closes #1618

commented

Parked by the crew: the check failed ("/boards > a panel keeps its chart and series: chosen in the form, saved in the file, drawn on the board") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs