Repository navigation
feat(auth): approve a FID relink from Admin > Users - #1230
Merged
Merged
Conversation
A FID-only account whose key changed with fid 5.0 can no longer prove it owns the account, so signing in through the portal with the new key now records a relink request (first request wins) that the primary admin approves or dismisses from the users list. The move logic is shared with fid:relink. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FeCp9YZh9dCEHXtRdpVeFe
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.
Why
After
fid5.0 re-keyed every identity, a FID-only account (no password; the server refuses to write one) cannot be reached any more, and the owner cannot prove the account is theirs because the old key can no longer be verified. #1229 addednpm run fid:relinkfor the operator; this makes the same fix available from the UI.What
zen_auth_mode = 'zen'), it now records a relink request (admin.fid_relink_pub,fid_relink_requested_at) and answers409 FID_KEY_CHANGEDwithrelinkRequested: trueand a message saying the administrator has to approve it. The first request wins (a different key getspendinguntil it is dismissed), so a stranger who knows the username cannot replace the owner's request. Accounts with a password never get one: they log in and link from their profile.POST /api/admin/system/users/:id/approve-fid-relink,DELETE /api/admin/system/users/:id/fid-relink, both gated onMANAGE_SYSTEMlike the artist-request approval they mirror). The approve dialog tells the admin to confirm with the person that the key is the one their portal shows.modules/auth/fid-relink.tsholdsrelinkFid,requestRelink,approveRelink,dismissRelink;fid:relinknow imports from it. Approving does exactly what the CLI does (sessions signed out, passports reset, old library records dropped).Security note
A new key proves only that its holder wants the account, not that they own it. Nothing is applied until the primary admin approves, and the approval is a deliberate, confirmed step. The unauthenticated surface is the SSO route that already existed (rate limited, token signature checked); it now writes one short row per eligible account.
Test plan
npx jest: 203 suites / 2598 tests;tsc --noEmitclean.fid-relink.test.ts(request recorded not applied; first request wins and is idempotent; password / unknown / malformed never qualify; approve moves the account and clears the request; approve needs a request; dismiss leaves the account alone). New SSO integration case: a new key for a FID-only account givesFID_KEY_CHANGED,relinkRequested, no token, and exactly one UPDATE with the new key.*.test.tsx; the 34 test-file errors in my localtsc -bare identical without this change (local install), CI builds it.🤖 Generated with Claude Code
https://claude.ai/code/session_01FeCp9YZh9dCEHXtRdpVeFe
Generated by Claude Code