Repository navigation
Conversation
Changing a user's access group, permissions or playback-quality override no longer revokes their sign-ins. The change still bumps access_policy_revision, and every request resolves the current policy. Password, enabled and role changes still sign the user out, on the v1 and v2 update paths alike. Also removes the unused AdminHandler.revokeUserSessions. Refs Silo-Server#1404
Deleting an access group still moves its members into the default group and bumps their access_policy_revision in the same transaction, but no longer signs them out. DeleteMovingMembers drops its in-transaction callback and the handler drops its session hook, since nothing else used them. Refs Silo-Server#1404
When the events socket's periodic recheck finds that the account role,
effective role, scope fingerprint or profile verification changed under a
still-valid login session, the connection loop now sends
{"type":"access_changed"} and closes with code 4001, reason
access_changed, instead of dropping the connection. A revoked or expired
session and a disabled account still close the socket as before.
The validator reports these cases with errSocketAccessChanged, which
wraps evt.ErrSocketTicket, so the playback-control, watch-together, admin
logs and Apple push callers keep their behavior.
Refs Silo-Server#1404
When the events socket sends access_changed or closes with code 4001, the web app marks libraries, home, catalog and search results, item details, collections, calendar, requests and downloads stale, re-reads the signed-in account so permission-gated controls follow the new policy, and reconnects without the usual one-second backoff. Refs Silo-Server#1404
The delete confirmation now says members move to the default group and get its access right away without being signed out, matching the server. Refs Silo-Server#1404
realtime-api.md documents the access_changed frame, close code 4001 and what clients do with them. admin-users-api.md lists which account updates still sign the user out and says group deletion keeps members signed in. Refs Silo-Server#1404
When a profile's viewer preferences cannot be read, the resolver falls back to their defaults. The scope fingerprint then differs from the ticket's, and the events socket told the client its access changed, making every affected client refetch everything while the database was already slow. The resolved scope now records the fallback. The periodic check skips the fingerprint comparison for that round, and the ticket mint refuses to fingerprint fallback preferences, as for any other failed read.
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Providing Context (Files & MCPs)Add these hints in your PR description (or a comment) to unlock deeper checks:
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 49 seconds. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (29)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| // Preferences that fell back to their defaults say nothing about | ||
| // whether access changed, so this round skips the comparison. | ||
| if identity.AccessFingerprint != "" && !scope.PreferencesDegraded && identity.AccessFingerprint != eventsScopeFingerprint(scope) { | ||
| return ctx, nil, errSocketAccessChanged |
There was a problem hiding this comment.
Access-change detection fails during degraded preference reads because validation skips the entire access fingerprint comparison, including successfully resolved policy revisions, library restrictions, and playback limits. If an unprotected profile's policy changes during a preference-read failure, validation succeeds without an access_changed signal, leaving the client with stale access-dependent data until a later successful preference read.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
Accurate, but the effect is a delay, not a missed change. A degraded round skips the comparison, but the ticket fingerprint stays fixed, so the next successful round (15 s later) still sees the difference and sends access_changed. Degraded only comes from a failed settings-store read, and the server resolves access per request regardless, so nothing is granted during the gap; only the client's notice is late. Not blocking. A follow-up could keep a second fingerprint over the preference-independent fields (libraries before the hidden-library subtraction, maturity, quality, bitrate, revision) and compare that on degraded rounds.
There was a problem hiding this comment.
Agreed—the finding describes a delayed client notification, not a permanently missed change or an enforcement gap. The ticket fingerprint stays fixed, so the first successful recheck detects the difference and sends access_changed. That may be the next 15-second recheck, or later if preference reads keep failing.
Given that access is enforced per request, the high-severity classification overstates the impact. I would treat this as a non-blocking resilience improvement.
A separate preference-independent fingerprint is a sensible follow-up: compare libraries before hidden-library filtering, maturity, quality, bitrate, and policy revision even during degraded reads, while leaving preference-sensitive comparisons deferred. No changes made.
There was a problem hiding this comment.
Not a defect, so no change. Skipping the comparison delays the signal by at most one recheck; it doesn't lose it. access_policy_revision and the library and quality limits live on the user and group rows, so the next recheck with a successful preference read still sees a different fingerprint and sends access_changed. Enforcement doesn't wait for the socket either, because every request resolves the current policy. Mint also refuses a ticket while preferences are degraded, so a socket can't open in that state. If the preference read keeps failing, the client loses the refresh hint, but it already has other trouble and its requests still enforce the new policy.
Comparing only the non-preference parts would mean storing a second fingerprint in every ticket, which costs more than one 15-second delay during a database fault.
There was a problem hiding this comment.
Agreed—the high-severity finding is not justified, and no code change is needed. The fixed ticket fingerprint preserves detection for the next successful preference read, while per-request policy resolution preserves enforcement. Refusing ticket minting during degraded reads also prevents a new socket from starting with a fallback fingerprint.
One qualification: “at most one recheck” assumes the next preference read succeeds. Consecutive failures can delay the notification longer, but they do not bypass access enforcement. A second fingerprint is unnecessary complexity for this non-blocking notification delay.
Review summaryReviewed head: What I checked
Verification
Validated features
Follow-ups
Mergeability: 9/10, ready. The rationale holds: tokens never carried policy, and every request resolves it. The change is bounded, tested at unit and live level, and required checks are green. AI-assisted review: Claude Code (claude-opus-5-5) with GitHub CLI. |
Silo-Server#1780 was squash-merged, and this branch edits lines its commits added, so a plain merge conflicts. The tree is this branch's own commits (b979d79..388816e) replayed onto main without conflicts. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: #1404
Validation tasks: changes #1197 C1
Moving a user to another access group signs them out on every device, and so
does changing their permissions or playback-quality override. Deleting a group
signs out every member it moves to the default group. Editing a group's own
policy signs no one out, so the stricter rule falls on the narrower change. This
change keeps users signed in for these policy changes and tells connected
clients to refresh what they show.
Tokens never carried the policy. Each request resolves the current access group,
permissions and quality limits from the database, and these changes already bump
access_policy_revision, which invalidates profile PIN tokens and v2 listcursors. The sign-out was not needed for enforcement. What was missing is a way
for a connected client to learn that its cached libraries and pages are out of
date: the events socket already closed when access changed, but without a reason,
so Web reconnected and kept its cache.
Approach
enabledchange, or a role change. Role changes keep signing out until afollow-up makes them refresh the access token instead (step 4 of Apply access-group changes without signing users out #1404).
revision, in the same transaction, but no longer revokes their sessions. The
store and handler drop the revocation hook they no longer need, and the unused
AdminHandler.revokeUserSessionsis removed.dead session. When the role, effective role, scope fingerprint or profile
verification changed under a valid session, the connection loop sends
{"type":"access_changed"}and closes with code4001, reasonaccess_changed. The connection loop writes both frames, because it is theonly data writer on the socket. A revoked or expired session and a disabled
account close the socket as before. The playback-control and Watch Together
sockets share the validator and keep closing without a frame.
search results, item details, collections, calendar, requests and downloads
stale, re-reads the signed-in account so permission-gated controls update, and
reconnects without the usual backoff. A PIN profile whose token the change
invalidated gets
profile_verification_requiredon the next ticket mint orrequest and goes back to profile selection, as it already does.
docs/realtime-api.mddocuments the frame, the close code and what clientsshould do;
docs/admin-users-api.mdlists which updates still sign users out.Playback that already started keeps the limits in its stream token until the
next start, as it already does after a group edit. Jellyfin-compatible sessions
are no longer dropped for these changes; their library and quality filters are
resolved per request.
Android (Silo-Server/silo-android#440) and Apple (Silo-Server/silo-apple#571)
handle
access_changedandprofile_verification_requiredand pair with thischange. Both work against older servers, so merge order does not matter.
Validation
access,api/handlers,eventsandauthpass,including the DB-backed group store tests against a migrated Postgres. New
tests cover v1 and v2 updates (no revocation for group, permission or quality
changes; revocation for password, disable and role), group deletion keeping a
member's session, validator classification, and a socket that receives the
frame and close code
4001on an access change but not on a revoked session.internal/apiv2andapi/handlerseach have one failure that also fails onmainin the same environment (TestAdminResourceCapabilitiesAndScope,TestAdminSubtitleListPageDB).make lint-changed: 0 issues. gofmt clean.make verify-local-pathspasses.clean; eslint adds no warnings. The full
make test-webrun fails only inAdminUserDetail.test.tsx, which fails the same way onmainon acase-insensitive file system;
tsc -breports only the matchingAdminUserDetail.tsximport error.Risks
than at sign-out. Server enforcement already worked this way for group edits
and per-user library changes.
until it refetches, as Web did before this change. Android and Apple need the
follow-ups above for the refresh.
language, hidden libraries) and the server's unrated-content setting. Changing
them already closed the socket; it now also makes Web refetch its
access-dependent queries once. A preference read that fails and falls back
to the defaults is not reported as a change: the recheck skips the comparison
for that round, and the ticket mint refuses, as for any other failed read.
Checklist
AI Disclosure
the branch diff for socket writer concurrency, goroutine leaks, validator
classification for the other sockets that share it, callers that relied on
the removed sign-out, Web reconnect loops, and whether the new tests fail on
the old behavior. It found no defects. It noted that the scope fingerprint
also covers profile preferences and the unrated-content setting, so those
changes now send
access_changed; the realtime docs say so. A second reviewof the finished branch found that a failed preference read, which falls back
to defaults, changed the fingerprint and was reported as an access change, so
a slow database would make every affected client refetch everything. Fixed:
the resolved scope records the fallback, the recheck skips the comparison
that round, and the ticket mint refuses; a test covers both.
Note
Keep users signed in across access-policy changes; signal events sockets with close code 4001
updateRequiresSessionRevocationin admin.go).access_policy_revisionin one transaction without revoking their sessions (group_store.go, admin_access_group_service.go).access_changedJSON frame plus websocket close code 4001 when role, scope fingerprint, or policy revision changes under a still-valid session (events_socket_v2.go).access_changedmessage or close code by invalidating access-dependent queries and calling the newrefreshAccounton the auth context, which re-reads/api/v2/account/mewithout clearing the session or query cache (RealtimeEventsProvider.tsx, useAuth.tsx).Scope.PreferencesDegraded(excluded from the access fingerprint) so the socket does not treat degraded defaults as an access change (viewer_preferences.go).memberMovingGroupStore.DeleteMovingMembersnow returns only an error (moved user IDs and the in-transaction callback are removed),OnUserSessionsRevokedis no longer wired to the access-group handler,EventsSocketV2.Mintrefuses tickets when preferences are degraded, and clients that ignore the 4001 signal simply reconnect and pick up the new policy on their next request.Macroscope summarized b979d79.