Repository navigation
fix(auth): let only the household manager disconnect a sign-in identity - #3967
Conversation
Any profile on an account, including a child profile on a household whose primary profile has a PIN, could disconnect one of the account's external sign-in identities, and the account's owner cannot always link it again because that needs the account's local password. deleteAccountIdentity is now profile scoped and requires the household manager, the rule personal API key creation uses: the primary profile, with its PIN verified when it has one. Another profile gets 403 permission_denied and an unverified primary profile gets 403 profile_verification_required. listAccountIdentities answers can_unlink by the same rule for the profile asking, and the web app shows its "only way to sign in" hint to the primary profile only. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
The web account page is reachable only by the primary profile or an acting admin, so the "only way to sign in" hint goes back to following can_unlink alone; limiting it to the primary profile hid it from an admin who has not chosen a profile. The docs now say which refusal each caller of deleteAccountIdentity gets, including the viewer gate's 404 for an unknown profile and 403 for a PIN-protected profile without its token. They also say the account cannot always link an identity again by itself, since an administrator can still link one. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 4 minutes. View limit details
Pre-merge checks:
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…o fix/account-identity-unlink-household-manager
Problem
Related issue: N/A
Validation tasks: none. No validation task covers disconnecting a sign-in identity.
Any profile on an account could disconnect one of the account's external sign-in identities (OIDC, LDAP or a network identity).
deleteAccountIdentitychecked only that the caller was the account's own login session and ignored which profile was acting, so a child profile could do it from any signed-in device, including on a household whose primary profile has a PIN. The account cannot always put the identity back by itself, because self-service linking needs the account's local password.Disconnecting now requires the household manager, the rule personal API key creation and Discord delivery settings already use.
Approach
deleteAccountIdentityis now profile scoped with an optional profile. The request must act as the account's primary profile, with its PIN verified when it has one. Another profile gets403 permission_denied, and a PIN-protected profile named without its token gets403 profile_verification_required. A request that names no profile is accepted only from an admin account's login session while no profile on the account is PIN-protected or access-restricted. A non-manager is refused before the identity ID is looked at. The own-login-session check and the409 last_sign_in_methodrule are unchanged.listAccountIdentitiesis still readable by every profile, and by a request that names none. Itscan_unlinknow also answers the household rule for the profile asking, so a client shows the control only where the call would succeed. To know that profile, the list became profile scoped with an optional profile as well./api/v2only; there is no v1 or Jellyfin route for this. The change is additive in shape: both operations gain the optional profile headers, and the descriptions change. The OpenAPI document, fixtures index and web types are regenerated, anddocs/auth-api.mdanddocs/architecture/external-sign-in.mdare updated.can_unlink.Validation
main, with one identity linked to a non-admin account that can also sign in with its local password, a child profile readcan_unlink: trueand itsDELETEanswered204; the identity was gone from the account's list and the administrator's. The same204came back with no profile named, and for the child profile while the primary profile had a PIN.200) withcan_unlink: false, and their deletes answered403 permission_denied; the identity stayed linked. The primary profile readcan_unlink: trueand its delete answered204. With a PIN on the primary profile, the list and the delete answered403 profile_verification_requiredwithout the token, and the delete answered204with it. Removing the account's only sign-in method still answered409 last_sign_in_method. For an identity ID that does not exist, the child profile got403and the primary profile404.mainwas built one commit behind this branch's base; the two differ only in two contributor documents.TestAccountIdentitiespasses on the branch. It does not build onmain, because it uses the dependency this change adds, so it has not been seen failing there. Removing the check from the delete, or from the list'scan_unlink, fails its secondary-profile and no-profile rows. The sandbox run above is the proof thatmainhas the gap.go build ./...,gofmt,go mod tidy -diff,go vet ./...,make lint-changed(0 issues) andmake lint-router-recoverypass.make test-go: 200 packages pass, including every package this touches. Eight tests ininternal/metadata/nfo,internal/scanner,internal/subtitles/subsyncandinternal/playbackfail the same way alone on the base on this Mac.TestHEVCFallbackProducesDecodableMain8FMP4failed once under the full suite's load and passes alone on both.make test-web(7,250 tests) pass.verify-apiv2-openapi,verify-apiv2-web-types,verify-apiv2-contract(6 changes, none breaking),verify-apiv2-fixtures,TestCommittedArtifactMatchesRouter,verify-local-paths,verify-offline-routesandverify-case-collisionspass.make verify-route-inventorycannot run on this host, on the branch or on the base; no route is added.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/account-identity-unlink-household-manager/
Risks
can_unlink: false: it hides Disconnect and shows its "only way to sign in" footer even when the account has another way in. The list and the rest of that screen still work. The web app, acting as the primary profile, is the workaround. fix(account): send the active profile when listing and disconnecting sign-in identities silo-apple#1118 is the paired change: it sends the profile on both calls.can_unlink: falseand sees the same footer text, which is wrong for it.deleteAccountIdentitywithoutX-Profile-Idon a non-admin account now gets403.contracts/api/v2/openapi.json, the fixtures index andweb/src/api/v2/schema.ts. Another open change that touches the same files will need to regenerate after whichever merges first.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Require household-manager permission to disconnect sign-in identities
Adds an authorization layer to both account-identity operations.
GET /api/v2/account/identitiesnow reportscan_unlinkbased on the household-management check for the active profile, andDELETE /api/v2/account/identities/{id}rejects non-manager profiles with permission denied.MayUnlinkAccountIdentitymethod onhandlers.ExternalSignInHandlerdelegates to the household-management check with a profile-verification callback; the router wires theUserStoreProviderinto the handler.MayUnlinkAccountIdentityin external_sign_in.go and route registration in external_sign_in.goMacroscope summarized 7e0fd08.