Skip to content

feat(auth): add OIDC and LDAP sign-in and TV device sign-in - #1799

Merged
Quick104 merged 14 commits into
mainfrom
t3code/oidc-sso-auth-support
Oct 2, 2026
Merged

Quick104 merged 14 commits into
mainfrom
t3code/oidc-sso-auth-support

Conversation

@Quick104

@Quick104 Quick104 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #905
Closes #554
Related issue: N/A
Validation tasks: changes #1193 C1, C2; changes #1194 C1; changes #1170 C1, C2; changes Silo-Server/silo-apple#320 C1; changes Silo-Server/silo-apple#321 C1; changes Silo-Server/silo-apple#326 C1; changes Silo-Server/silo-apple#327 C1, C2; changes Silo-Server/silo-android#330 C1; changes Silo-Server/silo-android#331 C1; changes Silo-Server/silo-android#336 C1; changes Silo-Server/silo-android#337 C1, C2; changes #1246 C1; changes #1229 C1; changes #1197 C1; changes #1200 C1, C2; #1196 C1, C2 and #1197 C2 unchanged while local password sign-in is on; local API-key cases #1190 C2, C3 and #1191 C1, C2 and server impersonation #1199 C1, C2 unchanged
Depends on: Silo-Server/silo-plugin-sdk#34 (merged, released as SDK v0.22.0). Plugins: Silo-Server/silo-plugin-auth-oidc, Silo-Server/silo-plugin-auth-ldap.

People can't sign in to Silo with the accounts they already have in a homelab identity provider (Authentik, Keycloak, Authelia, Pocket ID, Zitadel, Kanidm) or an LDAP directory. The auth_provider.v1 plugin contract existed, but the server could not use it safely. Sign-in results had no verified-email flag, groups or issuer, so accounts couldn't be matched or admins mapped. A person removed from the directory kept their Silo sessions and API keys. Admins couldn't make the provider the only way in without locking themselves out. The web OAuth button never left the page, because form-action 'self' blocks the redirect to the provider; #560 also addresses this. The phone and TV apps had no way to sign in through a browser at all.

TV sign-in also needed work. Its eight-character letter-and-digit codes are awkward to type on a phone keypad, ten minutes is short for a first setup, and a TV that gave up left its code approvable.

This change adds external sign-in through one provider per server, plus the TV device sign-in changes. The plugins live in their own repositories.

Approach

One provider, local accounts stay. A server enables at most one external provider binding. Local password sign-in stays on by default. An admin can turn it off only while at least one enabled "break-glass" admin can still sign in with a password, and only the Owner marks an account break-glass. The Owner is break-glass by default (set at first-run setup and on every ownership move) and can turn that off for their own account, so a provider outage can't lock out the one account that must stay reachable. silo auth local-login enable turns it back on from the host. While local sign-in is off, signup and invitations are refused (local_login_disabled), because they create password accounts.

Account resolution. A sign-in maps to an account in this order:

  1. A linked identity, keyed by issuer and subject.
  2. With auth.email_auto_match on (off by default), an ordinary account with the same verified email. Admins, the Owner and break-glass accounts never match this way.
  3. A new account when the provider's group rules admit the person and account creation is on.

Otherwise the refusal is account_required. The provider can manage the account's role through its admin groups. Password sign-ins without a provider name are routed by account, so a local password is never sent to the directory.

Provider re-checks. A session opened through the provider is re-checked with the plugin's CheckAccount at refresh, once the last answer is older than auth.provider_recheck_interval (12 h by default). A scheduled task re-checks identities whose credentials never refresh (API keys, Audiobookshelf sessions). A removed, disabled or refused account loses every session and its API keys. If the provider can't re-check (an OIDC provider that issued no refresh token), sessions stop sliding and end 30 days after the provider last vouched for them. auth.provider_recheck_outage_policy chooses fail-open (the default) or fail-closed when the provider is down.

Web and native flows.

  • The web uses a GET start link with a browser-binding cookie, and the completion code is bound to the browser that started the flow.
  • Apps open the native start on their saved server address in the system browser, with PKCE S256. The app redirect carries iss, the origin where the native start first arrived. The app accepts it only if it equals its saved server's origin, and redeems the code only there, so a hostile saved server can't relay a sign-in by redirect.
  • A start on a LAN address continues on the public URL, carrying only an opaque flow ID.
  • The login session opens when the code is redeemed.
  • Linking uses short-lived tickets, and LDAP links with directory credentials after a local password check.
  • Web sign-out can also end the provider session (getProviderLogout).

TV device sign-in. Codes are eight digits shown as 4+4 and last 15 minutes. The QR link is <public URL>/activate?code=. The TV is told when someone opens its code, and a TV can withdraw its own request (canceled). Approving needs the approver's own login session, not an API key or an impersonation session. The frozen v1 routes keep their shape and report a canceled request as denied.

Surfaces. v2 gains the identity, linking, connection-test and provider-logout operations, with capability endpoints getExternalSignInCapabilities and getOAuthHandshakeCapabilities. Two response-property-enum-value-added approvals cover canceled on device-login lookup and poll; breaking-approvals.json gives the reasoning. The web adds Settings → Sign-in for admins, a Sign-in section in account settings, a Sign-in tab on the admin user page, and provider buttons on login and /activate. Settings → Sign-in shows one provider at a time as numbered setup steps (register Silo, connect, choose who can sign in, test, login button) built from the plugin's admin_form sections; sections the plugin marks collapsible go under Advanced. Plugin settings and account creation save from the page's save bar with the server settings, while turning a provider on or off applies at once and needs its required fields saved first. Three migrations add the identity, flow and device-login columns and tables, and a fourth marks the existing Owner break-glass.

The rules are written down in docs/architecture/external-sign-in.md and docs/architecture/device-login.md; the API is in docs/auth-api.md.

Validation

The following validation was reported by the author before independent review. Review verification is listed separately below.

  • go build, go vet, gofmt and make test-go pass, except TestAdminResourceCapabilitiesAndScope, which also fails on main on macOS (no cgroups).
  • All verify-* contract targets pass: settings bindings, playback fixtures, route inventory, migration ledger, scenario catalogs, offline routes, OpenAPI, the contract diff against main, fixtures and local paths.
  • Postgres-backed tests for every touched package pass on a fresh, fully migrated database. The new CI steps (device sign-in and external sign-in) pass in CI order. Two failures also occur on main: TestAdminSubtitleListPageDB and TestOrphanCleanupAfterPlexTableDropPostgres. A third, TestCollectionCollageReadsKeepActiveVariantsDB, failed only because the Docker database's clock lagged the host's.
  • Web lint, format, typecheck and build pass on Linux, and all 743 test files pass. On macOS, tsc fails on main too, because UserDetailTabs.tsx and userDetailTabs.ts differ only in case.
  • The launch bundle grows by 2,097 B brotli. perf-budget.json is raised to 318,728 B. The login page loads eagerly, and it now carries the provider sign-in buttons; the API client also gains provider-outage handling on refresh.
  • Live end to end on a single-node sandbox:
    • OIDC sign-in with authentik, Keycloak, Authelia, Pocket ID, Zitadel, Kanidm and Tinyauth.
    • LDAP sign-in with lldap, OpenLDAP (StartTLS and LDAPS), Kanidm and the authentik LDAP outpost.
    • Web sign-in, linking and sign-out; /activate; native sign-in from the iOS, tvOS and Android apps on simulators and emulators.
    • Re-check revocation on Keycloak, OpenLDAP and Authelia.
    • Local login off with Jellyfin clients and the recovery CLI.
  • Settings → Sign-in guided setup: the Sign-in page tests and the 143 related web test files pass. The page was checked read-only against a shared development server, first with the plugins' current manifests and then with the plugin list rewritten in the browser to the updated OIDC and LDAP manifests.
  • Not run live: multi-node flows (covered by cross-node DB tests), Active Directory, FreeIPA and Google, and macOS app sign-in (built only).

Review fixes preserve the submitting session for identity writes, refresh provider discovery, serialize local login and identity administration with account changes, and withdraw revoked provider approvals. Provider re-checks retain uncertain state, ignore answers after unlinking and use one database connection. Failed ACTIVE role synchronization remains due after an outage, and activation state is isolated for each code/token. OAuth completion locks account and installation authority through session creation and returns that account snapshot; native capability, origin matching, provider availability, invitation policy and Jellyfin retries have regression coverage.

Independent review verification:

  • Go build/vet passed, including a final focused vet pass. The full local non-DB suite passed before the final OAuth authority repair; affected race suites passed afterward. Changed-line lint reported zero findings; the final repair and reconciliation passes also reported zero findings. Contract, migration, route, fixture and local-path checks passed.
  • All 745 web test files passed on the final source (6,666 tests); web lint, format, build and bundle budget passed. The launch bundle measured 318,489 B brotli against the 318,728 B budget.
  • The full auth database race suite passed, along with final OAuth authority/store/API race regressions, device approval retries, and all 105 database query-budget pins. Invitation, plugin and Jellyfin DB race suites passed; the full v2 API database suite passed separately.
  • Three broad DB fixture failures were independently reproduced against actual main source: TestAdminSubtitleListPageDB, TestCatalogTransferPersistsJobsAndSignedLink and TestOrphanCleanupAfterPlexTableDropPostgres. The full API race run hit its ten-minute suite timeout while progressing through tests, with no race report.
  • A rebuilt isolated server verified numeric device codes, 900-second expiry, opened signal, cancellation and final poll; six requests correlate with timestamped logs. Browser discovery and switching activation requests have before/after captures of the real components using synthetic responses.
  • Independent live IdP and native-client sign-in were not run. The author's live results above remain author evidence. Final-head CI is running on d6773b82da8c5939c97cdf42c6fea2239efb7030. Final follow-up checks passed: eight provider recovery database race tests, the full invitation database race suite, focused invitation/device API race tests, linking regression, web lint/format/build/budget and contract/fixture/path checks. One invitation ordering test failed once; focused repeats and the complete suite rerun passed. The local changed-line lint run is queued behind another run.

Evidence: https://evidence.siloserver.org/r/silo-server/pr-1799/

Risks

  • Migrations. Three migrations only add columns and tables, and existing accounts keep local password sign-in. The fourth sets break_glass on the existing Owner; an Owner whose password sign-in was already off stays off until a password is set. Databases that ran this branch's earlier unreleased migrations need a fresh database.
  • Security. This is security-sensitive: account matching, session revocation and the native handoff all decide who gets in. The design choices are in docs/architecture/external-sign-in.md.
  • Known gap: relay by request. The iss check does not stop a relay by request. A hostile server on a LAN address, or behind a network access provider, can send an app's native start to the real server itself. docs/auth-api.md describes this, and it is accepted.
  • Public path. Device verification URLs preserve the configured escaped path. The stock web router’s existing lack of a basename remains a deployment limitation.
  • Plugin manifests. The guided Sign-in layout follows each plugin's admin_form sections. The OIDC and LDAP plugins need manifest updates that are not released yet: steps and Advanced sections, standard labels (Bind DN, User search base DN, Token endpoint auth method, User identifier), and connection_test_username_field for the LDAP test user. With the current plugin releases the page still works, but every manifest section shows as its own numbered step.
  • Client coordination. Apple changes are tracked in feat(auth): sign in with the server's identity provider and the new TV sign-in silo-apple#579. Android changes are tracked in feat(auth): sign in with the server's identity provider and the new TV sign-in silo-android#448; both client changes need review and coordinated release. The manual update is tracked in Manual: sign in with an identity provider (OIDC, LDAP) and the new TV sign-in codes siloserver.org#69.
  • Client coordination scope. The Apple and Android TV and phone apps need their matching changes to use native sign-in, the eight-digit codes and canceled. Older apps keep working: they show the codes and fall back to password sign-in.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code, run inside T3 Code
  • Tool(s): Claude Code with subagents and multi-agent workflows; Codex in T3 Code for part of the review fixes
  • Model(s): claude-opus-5-5; gpt-6.1-sol (Codex)
  • Involvement: Original implementation fully AI-generated and human verified by the author; review repairs generated and verified by Codex
  • Independent review and repairs: Codex harness in T3 Code, model gpt-6.1-sol, with independent subagent reviews and regression tests.
  • Adversarial review: four cross-repository audit rounds over the server, SDK, plugins and apps (21, 18, 15 and 15 confirmed findings, all fixed), plus per-repository reviews and a security review of the native handoff. That review led to the start-origin iss rule, browser-bound completion codes, and opening the session only when the code is redeemed. The independent Codex review reproduced ten findings and repaired them, alongside verified bot findings, with concurrency tests and private evidence.

Note

Add OIDC/LDAP external sign-in, break-glass accounts, and TV device sign-in

  • Adds external sign-in via plugin providers (OAuth/OIDC and credentials/LDAP), with account resolution, identity linking, session refresh provider re-checks, and provider logout. Plugin providers are rebuilt dynamically via PluginProviderRegistry after binding changes instead of being fixed at startup.
  • Adds break-glass admin accounts: local password login can be disabled server-wide, but the owner and break-glass admins keep local sign-in. Disabling local login or deleting the last usable break-glass admin returns HTTP 409, and a silo auth local-login enable CLI recovers access.
  • Reworks TV device sign-in: 15-minute requests with eight-digit numeric codes, an opened signal for approvers, device-side cancellation, and session-provider-chain inheritance. v1 routes keep their frozen behavior via Legacy flags and status mapping.
  • OAuth flows now bind the initiating browser with cookies, support PKCE-bound native app starts parked on the public origin, and open sessions atomically during completion-code redemption with reuse detection and session revocation.
  • Behavioral Change: many auth responses changed — provider-unavailable refresh returns 503 (session kept valid), OAuth completion requires a browser cookie or PKCE verifier and returns invalid_grant, invitation acceptance can fail with 403 local_login_disabled, and completion rows no longer store provider tokens. Migrations add break-glass, device-login, and OAuth-flow columns/tables; v1 surfaces map canceled device requests to denied.

Macroscope summarized faa6317.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 277 files, which is 177 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: e0748cf0-c7b2-4293-a1f7-ecb6911664d5

📥 Commits

Reviewing files that changed from the base of the PR and between 7100d4f and faa6317.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (277)
  • .github/workflows/trusted-linux-ci.yml
  • cmd/silo/auth_command.go
  • cmd/silo/auth_command_test.go
  • cmd/silo/main.go
  • contracts/api/v2/breaking-approvals.json
  • contracts/api/v2/fixtures/admin_account_delete_break_glass_required.json
  • contracts/api/v2/fixtures/admin_account_get.json
  • contracts/api/v2/fixtures/approve_device_login_api_key_forbidden.json
  • contracts/api/v2/fixtures/cancel_device_login_not_found.json
  • contracts/api/v2/fixtures/cancel_device_login_ok.json
  • contracts/api/v2/fixtures/complete_account_identity_link_invalid_grant.json
  • contracts/api/v2/fixtures/complete_oauth_login_invalid_grant.json
  • contracts/api/v2/fixtures/complete_oauth_login_native_ok.json
  • contracts/api/v2/fixtures/complete_oauth_login_ok.json
  • contracts/api/v2/fixtures/create_account_identity_link_ticket_ok.json
  • contracts/api/v2/fixtures/create_account_identity_link_ticket_wrong_password.json
  • contracts/api/v2/fixtures/create_admin_user_identity_linked_elsewhere.json
  • contracts/api/v2/fixtures/create_admin_user_identity_ok.json
  • contracts/api/v2/fixtures/delete_account_identity_last_sign_in_method.json
  • contracts/api/v2/fixtures/get_device_login_capability_ok.json
  • contracts/api/v2/fixtures/get_device_login_ok.json
  • contracts/api/v2/fixtures/get_external_sign_in_capabilities_ok.json
  • contracts/api/v2/fixtures/get_oauth_handshake_capabilities_ok.json
  • contracts/api/v2/fixtures/get_provider_logout_api_key_empty.json
  • contracts/api/v2/fixtures/get_provider_logout_impersonation_empty.json
  • contracts/api/v2/fixtures/get_provider_logout_ok.json
  • contracts/api/v2/fixtures/get_system_info_ok.json
  • contracts/api/v2/fixtures/index.json
  • contracts/api/v2/fixtures/link_account_identity_with_credentials_directory_refused.json
  • contracts/api/v2/fixtures/link_account_identity_with_credentials_ok.json
  • contracts/api/v2/fixtures/list_account_identities_ok.json
  • contracts/api/v2/fixtures/list_admin_user_identities_ok.json
  • contracts/api/v2/fixtures/list_admin_users_exact_identity.json
  • contracts/api/v2/fixtures/list_admin_users_ok.json
  • contracts/api/v2/fixtures/list_auth_providers_ok.json
  • contracts/api/v2/fixtures/login_account_required.json
  • contracts/api/v2/fixtures/poll_device_login_ok.json
  • contracts/api/v2/fixtures/poll_device_login_opened.json
  • contracts/api/v2/fixtures/refresh_session_provider_unavailable.json
  • contracts/api/v2/fixtures/start_account_identity_link_ok.json
  • contracts/api/v2/fixtures/start_account_identity_link_unknown_ticket.json
  • contracts/api/v2/fixtures/start_device_login_ok.json
  • contracts/api/v2/fixtures/test_admin_plugin_auth_binding_ok.json
  • contracts/api/v2/migration.json
  • contracts/api/v2/openapi.json
  • contracts/api/v2/route-inventory.json
  • contracts/api/v2/scenarios/api/api-v1-auth-oauth-install_id.json
  • contracts/api/v2/scenarios/api/api-v1-auth.json
  • docs/admin-api.md
  • docs/admin-users-api.md
  • docs/architecture/device-login.md
  • docs/architecture/external-sign-in.md
  • docs/architecture/password-resets.md
  • docs/architecture/scenario-acceptance.md
  • docs/architecture/schema-standardization.md
  • docs/architecture/secret-encryption.md
  • docs/auth-api.md
  • docs/settings-api.md
  • go.mod
  • internal/api/handlers/admin.go
  • internal/api/handlers/admin_invitations.go
  • internal/api/handlers/admin_local_login_setting_test.go
  • internal/api/handlers/admin_temporary_password_test.go
  • internal/api/handlers/admin_users_service.go
  • internal/api/handlers/apierror.go
  • internal/api/handlers/auth.go
  • internal/api/handlers/auth_device.go
  • internal/api/handlers/auth_device_db_test.go
  • internal/api/handlers/auth_device_test.go
  • internal/api/handlers/auth_external_refusal_test.go
  • internal/api/handlers/auth_registration.go
  • internal/api/handlers/external_sign_in.go
  • internal/api/handlers/external_sign_in_db_test.go
  • internal/api/handlers/invitations.go
  • internal/api/handlers/local_login_setting_db_test.go
  • internal/api/handlers/owner.go
  • internal/api/handlers/owner_test.go
  • internal/api/handlers/plugins.go
  • internal/api/router.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_accounts.go
  • internal/apiv2/admin_accounts_test.go
  • internal/apiv2/admin_plugin_configuration.go
  • internal/apiv2/admin_plugin_configuration_test.go
  • internal/apiv2/admin_plugin_installations.go
  • internal/apiv2/admin_plugin_installations_test.go
  • internal/apiv2/admin_plugin_lifecycle.go
  • internal/apiv2/admin_plugin_uploads.go
  • internal/apiv2/admin_settings_write.go
  • internal/apiv2/admin_users.go
  • internal/apiv2/auth.go
  • internal/apiv2/auth_provider_icons_test.go
  • internal/apiv2/auth_sessions.go
  • internal/apiv2/auth_sessions_test.go
  • internal/apiv2/auth_test.go
  • internal/apiv2/device_login.go
  • internal/apiv2/device_login_test.go
  • internal/apiv2/document.go
  • internal/apiv2/document_test.go
  • internal/apiv2/external_sign_in.go
  • internal/apiv2/external_sign_in_fixtures_test.go
  • internal/apiv2/external_sign_in_test.go
  • internal/apiv2/fixtures_test.go
  • internal/apiv2/invitations.go
  • internal/apiv2/oauth_availability_test.go
  • internal/apiv2/oauth_completion_account_test.go
  • internal/apiv2/oauth_handshakes.go
  • internal/apiv2/oauth_handshakes_test.go
  • internal/apiv2/pilot_fakes_test.go
  • internal/apiv2/problem.go
  • internal/apiv2/router.go
  • internal/audiobooks/abs/login.go
  • internal/auth/account_provisioner.go
  • internal/auth/account_resolution.go
  • internal/auth/credentials_link.go
  • internal/auth/credentials_link_db_test.go
  • internal/auth/device_login.go
  • internal/auth/device_login_db_test.go
  • internal/auth/device_login_revocation_db_test.go
  • internal/auth/device_login_test.go
  • internal/auth/external_identity.go
  • internal/auth/external_identity_test.go
  • internal/auth/external_sign_in_db_test.go
  • internal/auth/identity_repository.go
  • internal/auth/identity_service.go
  • internal/auth/jwt.go
  • internal/auth/local_login_policy.go
  • internal/auth/local_login_revocation_db_test.go
  • internal/auth/local_signup_policy_db_test.go
  • internal/auth/oauth_completion_authority_db_test.go
  • internal/auth/oauth_flow.go
  • internal/auth/oauth_flow_db_test.go
  • internal/auth/oauth_handler.go
  • internal/auth/oauth_handler_test.go
  • internal/auth/oauth_origin_test.go
  • internal/auth/oauth_state.go
  • internal/auth/oauth_store.go
  • internal/auth/oauth_store_migration_test.go
  • internal/auth/oauth_store_test.go
  • internal/auth/owner.go
  • internal/auth/owner_test.go
  • internal/auth/plugin_provider.go
  • internal/auth/provider.go
  • internal/auth/provider_recheck.go
  • internal/auth/provider_recheck_concurrency_db_test.go
  • internal/auth/provider_recheck_db_test.go
  • internal/auth/provider_recheck_lost_state_db_test.go
  • internal/auth/provider_recheck_test.go
  • internal/auth/provider_registry.go
  • internal/auth/provider_registry_test.go
  • internal/auth/repository.go
  • internal/auth/service.go
  • internal/auth/session.go
  • internal/cache/redis.go
  • internal/catalog/encrypted_settings_repo.go
  • internal/catalog/server_settings_repo.go
  • internal/clientip/middleware.go
  • internal/clientip/request_scheme_test.go
  • internal/clientip/resolver.go
  • internal/config/admin_settings.go
  • internal/config/admin_settings_test.go
  • internal/contractledger/ledger_test.go
  • internal/invitations/local_login_policy_db_test.go
  • internal/invitations/repository.go
  • internal/invitations/service.go
  • internal/invitations/service_test.go
  • internal/jellycompat/login.go
  • internal/jellycompat/login_directory_db_test.go
  • internal/jellycompat/login_password_change_test.go
  • internal/jellycompat/login_routing_race_db_test.go
  • internal/models/session.go
  • internal/models/user.go
  • internal/pluginhost/client.go
  • internal/plugins/auth_binding_db_test.go
  • internal/plugins/http_proxy.go
  • internal/plugins/http_proxy_nosniff_test.go
  • internal/plugins/runtime_config.go
  • internal/plugins/service_admin_config.go
  • internal/plugins/service_auth_connection.go
  • internal/plugins/service_auth_connection_test.go
  • internal/plugins/service_connection.go
  • internal/plugins/service_connection_test.go
  • internal/routeinventory/classify.go
  • internal/scenariocatalog/device_start_lookup_originals.json
  • internal/scenariocatalog/executor/auth_lifecycle_pairing_test.go
  • internal/scenariocatalog/executor/device_decisions_pairing_test.go
  • internal/scenariocatalog/executor/device_lookup_pairing_test.go
  • internal/scenariocatalog/executor/device_start_lookup_pairing_test.go
  • internal/scenariocatalog/executor/env.go
  • internal/scenariocatalog/oauth_refusals_pairing.go
  • internal/taskmanager/tasks/cleanup_device_logins.go
  • internal/taskmanager/tasks/cleanup_device_logins_test.go
  • internal/taskmanager/tasks/cleanup_oauth_flows.go
  • internal/taskmanager/tasks/cleanup_oauth_flows_test.go
  • internal/taskmanager/tasks/database_maintenance.go
  • internal/taskmanager/tasks/recheck_external_identities.go
  • internal/taskmanager/tasks/recheck_external_identities_test.go
  • internal/workmetrics/work.go
  • migrations/sql/20261002073659_device_login_cancel_open_and_provider_chain.sql
  • migrations/sql/20261002073701_external_sign_in_accounts.sql
  • migrations/sql/20261002073703_oauth_sign_in_flows.sql
  • migrations/sql/20261002175237_owner_break_glass_default.sql
  • web/perf-budget.json
  • web/src/api/client.ts
  • web/src/api/types.ts
  • web/src/api/v2/adminUsers.ts
  • web/src/api/v2/operations.ts
  • web/src/api/v2/providerLogout.test.ts
  • web/src/api/v2/providerLogout.ts
  • web/src/api/v2/schema.ts
  • web/src/components/AdminUserDeleteDialog.test.tsx
  • web/src/components/AdminUserSetPasswordDialog.tsx
  • web/src/components/admin/AdminUserSignIn.test.tsx
  • web/src/components/admin/AdminUserSignIn.tsx
  • web/src/components/admin/FeedbackLine.tsx
  • web/src/components/admin/plugins/PluginConfigForm.test.tsx
  • web/src/components/admin/plugins/PluginConfigForm.tsx
  • web/src/components/admin/plugins/PluginDetailSections.tsx
  • web/src/components/admin/plugins/SchemaForm.test.tsx
  • web/src/components/admin/plugins/SchemaForm.tsx
  • web/src/components/admin/plugins/configSchemaAdminForm.ts
  • web/src/components/admin/plugins/schemaFormUtils.test.ts
  • web/src/components/admin/plugins/schemaFormUtils.ts
  • web/src/hooks/AuthProvider.providers.test.tsx
  • web/src/hooks/AuthProvider.sessionRestore.test.tsx
  • web/src/hooks/AuthProvider.test.tsx
  • web/src/hooks/admin/useSettingsOverview.test.ts
  • web/src/hooks/admin/useSettingsOverview.ts
  • web/src/hooks/queries/account.authority.test.tsx
  • web/src/hooks/queries/account.ts
  • web/src/hooks/queries/admin/externalSignIn.ts
  • web/src/hooks/queries/admin/plugins.ts
  • web/src/hooks/queries/admin/settings.ts
  • web/src/hooks/queries/authCore.v2.test.ts
  • web/src/hooks/queries/authProviders.ts
  • web/src/hooks/useAuth.tsx
  • web/src/lib/adminSettingsSearch.ts
  • web/src/lib/appDeepLink.test.ts
  • web/src/lib/appDeepLink.ts
  • web/src/lib/deviceCode.test.ts
  • web/src/lib/deviceCode.ts
  • web/src/lib/externalSignIn.ts
  • web/src/lib/externalSignInAdmin.ts
  • web/src/pages/ActivateDevice.test.tsx
  • web/src/pages/ActivateDevice.tsx
  • web/src/pages/AdminUserDetail.test.tsx
  • web/src/pages/AdminUserDetail.tsx
  • web/src/pages/AdminUsers.test.tsx
  • web/src/pages/InviteClaim.tsx
  • web/src/pages/InviteClaim.v2.test.tsx
  • web/src/pages/Login.deviceSignIn.test.tsx
  • web/src/pages/Login.directory.test.tsx
  • web/src/pages/Login.externalSignIn.test.tsx
  • web/src/pages/Login.oauth.v2.test.tsx
  • web/src/pages/Login.tsx
  • web/src/pages/OAuthComplete.test.tsx
  • web/src/pages/OAuthComplete.tsx
  • web/src/pages/admin-settings/AdminSettingsLayout.tsx
  • web/src/pages/admin-settings/SecurityAccessSettings.tsx
  • web/src/pages/admin-settings/SignInConfigField.tsx
  • web/src/pages/admin-settings/SignInProviderSlot.tsx
  • web/src/pages/admin-settings/SignInSettings.test.tsx
  • web/src/pages/admin-settings/SignInSettings.tsx
  • web/src/pages/admin-settings/signInSetup.test.ts
  • web/src/pages/admin-settings/signInSetup.ts
  • web/src/pages/admin-settings/useSignInProviderDrafts.ts
  • web/src/pages/admin-users/detail/UserDetailHeader.tsx
  • web/src/pages/admin-users/detail/UserDetailTabs.tsx
  • web/src/pages/admin-users/detail/access/AccessTab.test.tsx
  • web/src/pages/admin-users/detail/access/RequestsCard.test.tsx
  • web/src/pages/admin-users/detail/access/policySources.test.ts
  • web/src/pages/admin-users/detail/overview/OverviewTab.test.tsx
  • web/src/pages/admin-users/detail/userDetailTabs.ts
  • web/src/pages/settings/AccountSettings.test.tsx
  • web/src/pages/settings/AccountSettings.tsx
  • web/src/pages/settings/AccountSignInSection.test.tsx
  • web/src/pages/settings/AccountSignInSection.tsx

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Adds sign-in through one external identity provider per server, provided
by auth_provider.v1 plugins (OIDC and LDAP): account resolution and
linking, group-gated account creation, role sync, break-glass local admins
and a server switch for local password sign-in, a native app handoff with
PKCE that binds the result to the app's saved server, provider re-checks
that revoke refused accounts, and web sign-in, account and admin screens.

TV device sign-in gains eight-digit codes, a 15-minute lifetime, an
/activate link on the public URL, an opened signal and device-side cancel.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Quick104

Quick104 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Quick104

Quick104 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@macroscope-app revoew

@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Manual reviews triggered for commit 9f6ea58:

All prior checks · these links stay valid even if you push more commits.

@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026

Copy link
Copy Markdown

Review started; results will be posted as check runs.

@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The Web admin results for #1197 C1 and C2 need a re-check after merge: the admin user page now always shows a Sign-in tab, an extra entry point during account/policy setup and invitation membership checks. The current Validation tasks: line incorrectly labels them unchanged. #1196 C1/C2 have no behavior change: policy/group handling is unchanged, and the invitation guard only applies when local password sign-in is off (default on).

Suggested fix (no diff; this is PR description text):
Validation tasks: changes #1193 C1, C2; changes #1194 C1; unchanged #1196 C1, C2 while local password sign-in is on; changes #1197 C1, C2

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

Comment thread internal/auth/oauth_flow.go Resolved
Comment thread internal/apiv2/auth.go Resolved
Comment thread internal/auth/oauth_store.go Resolved
Comment thread internal/auth/provider_registry.go Resolved
Comment thread internal/auth/provider_recheck.go Resolved
Comment thread internal/auth/service.go Resolved
Comment thread internal/auth/device_login.go Resolved
Comment thread internal/jellycompat/login.go Resolved
Comment thread internal/apiv2/oauth_handshakes.go Resolved
Comment thread internal/auth/service.go Resolved
@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026

Copy link
Copy Markdown

The passed Web-admin cases #1197 C1/C2 and #1200 C1/C2 need a minor re-check: the account-detail page now shows a Sign-in tab alongside the controls used for user management and impersonation. The linked Apple and Android TV sign-in cases also exercise device-approval and credential paths changed here; those cases are currently Not run and should be listed for first validation.

Suggested replacement:

Validation tasks: changes #1193 C1, C2; changes #1194 C1; changes Silo-Server/silo-apple#326 C1; changes Silo-Server/silo-apple#327 C1, C2, C3; changes Silo-Server/silo-android#336 C1; changes Silo-Server/silo-android#337 C1, C2, C3; #1196 C2 unchanged while local password sign-in is on (the default); changes #1197 C1, C2; changes #1200 C1, C2

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

@Quick104 Quick104 left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the original head 9f6ea58 and the author’s subsequent commits. All ten independent findings are repaired at d6773b8, including the earlier fixes in b1b9ecd. Main’s invitation changes are reconciled, and the released SDK v0.22.0 is pinned.

[P1] Serialize local password sign-in with provider linking — internal/auth/service.go, loginWithProvider

A password sign-in can authenticate an account and pause before its session is inserted. A concurrent email auto-match then links that account to a verified external identity, disables its local password and revokes existing credentials. The paused local sign-in resumes and creates an identity-free session after revocation; refresh still succeeds, so the former local account holder retains access outside provider re-checks. A deterministic database test reproduced the successful sign-in and refresh with local password sign-in already disabled. Recheck the account and local-password authority under its row lock in the transaction that inserts the session. Fixed in b1b9ecd; focused database race regressions passed.

[P1] Revalidate current authority during OAuth completion — internal/auth/service.go, OpenOAuthSession

Redemption reads an enabled account without holding its row lock, then inserts the session. A deterministic database test held that account row while redemption began, committed account disable and credential revocation, and observed redemption create a fresh unrevoked session from its earlier enabled-account snapshot. The issued token grants access even though the account is already disabled. A separate callback → installation disable → redemption test also opened a valid session, although the documented contract says a disabled installation accepts nobody. Re-read the account under its row lock and check the installation in the redemption transaction before opening the session. Fixed in b1b9ecd; focused database race regressions passed.

[P2] Keep device approval results on the request that submitted them — web/src/pages/ActivateDevice.tsx

At 1c8029f, approve one TV and choose “Enter another code” while its POST is still in flight. Load a second pending TV, let the first approval succeed, then fail its follow-up GET. The second TV now shows “Done. Your TV is signing in.” even though the only approval POST used the first code. A deferred-response renderer test reproduces this on the new source; the same test leaves the second TV pending on b1b9ecd. Give each code/token its own component state so late responses cannot change a different request. Fixed in d6773b8. All 15 activation tests passed; before/after captures of the real component confirm the second TV stays pending.

[P1] Keep failed ACTIVE role synchronization due after an outage — internal/auth/provider_recheck.go

An unavailable identity becomes due after the short outage retry interval. If its next ACTIVE/USER answer rotates state but administrator demotion then times out on an account lock, 1c8029f restores the previous timestamp while leaving its status active. With that timestamp only three minutes old and the normal 12-hour interval, the next refresh skips the provider and issues another administrator token. A deterministic database proof reproduced this using the normal interval. Clear the failed role-sync check timestamp so the next refresh remains due while retaining the replacement state and latest successful-authentication time. Fixed in d6773b8. The new regression and seven related database tests passed with race detection.

AI disclosure: Codex harness in T3 Code; gpt-6.1-sol, with independent subagent reviews of accounts, provider re-checks and web/API flows.

Comment thread internal/auth/device_login.go Resolved
Comment thread web/src/hooks/queries/account.ts Resolved
Comment thread internal/auth/identity_service.go Resolved
Comment thread internal/auth/provider_recheck.go Resolved
@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026

Copy link
Copy Markdown

Major changes:

Minor changes:

The user-management results #1196 C1–C2 and #1197 C2 remain unchanged with local password sign-in on: the new invite/break-glass guards do not change those steps under the default setting. #1190 C1–C2's local API-key checks are also unchanged; provider re-check revocation applies to externally linked identities. I could not enumerate Validation tasks in Silo-Server/silo-plugin-auth-oidc or Silo-Server/silo-plugin-auth-ldap because GitHub returned not found/not accessible, so confirm any plugin task IDs separately.

Suggested fix (no diff; replace the Validation tasks: line):

Validation tasks: changes #1193 C1, C2; #1194 C1; #1170 C1, C2; Silo-Server/silo-apple#320 C1; Silo-Server/silo-apple#321 C1; Silo-Server/silo-apple#326 C1; Silo-Server/silo-apple#327 C1, C2; Silo-Server/silo-android#330 C1; Silo-Server/silo-android#331 C1; Silo-Server/silo-android#336 C1; Silo-Server/silo-android#337 C1, C2; #1246 C1; #1197 C1; #1229 C1; unchanged #1190 C1, C2; #1196 C1, C2; #1197 C2

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The Validation tasks: line is incomplete. The new Sign-in tab is visible in the admin user-detail view, so Web admin cases #1197 C1 and #1200 C1/C2 with prior results need a UI re-check, not an unchanged label. The server device-login changes also affect cross-repo pairing cases #326 C1, #327 C1/C2, #336 C1 and #337 C1/C2. Those client cases are Not run, so no prior results are invalidated, but they should be tracked for validation.

Suggested corrected line:
Validation tasks: changes #1193 C1, C2; changes #1194 C1; changes Silo-Server/silo-apple#326 C1; changes Silo-Server/silo-apple#327 C1, C2; changes Silo-Server/silo-android#336 C1; changes Silo-Server/silo-android#337 C1, C2; changes #1197 C1; changes #1200 C1, C2; #1196 C2 and #1197 C2 unchanged while local password sign-in is on (the default)

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Comment thread internal/apiv2/device_login.go Resolved
Comment thread internal/apiv2/oauth_handshakes.go Resolved
Comment thread internal/auth/account_resolution.go Resolved
Comment thread internal/auth/identity_service.go Resolved
Comment thread internal/auth/oauth_handler.go Resolved
Comment thread internal/auth/provider_recheck.go Resolved
Comment thread internal/auth/provider_recheck.go Resolved
@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

A password sign-in that names a provider by ID now resolves only built-in
providers and credentials (directory) plugins. Naming an OAuth plugin fails
as wrong credentials before the plugin is asked, so the password never
reaches it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

The Owner is the one account that must never be locked out by a sign-in
provider outage. First-run setup and every ownership move now mark the new
Owner break-glass, and a migration marks the existing one, so it keeps
password sign-in when local sign-in is off and when it links a provider.
The Owner can still clear the flag on its own account while another usable
break-glass admin exists.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Show one sign-in plugin at a time as numbered setup steps built from its
manifest's admin_form sections, with collapsible sections under Advanced.
Plugin config and account creation now save from the page save bar;
turning a provider on or off still applies at once, and Turn on waits for
the required fields. The connection test can ask for a look-up user named
by capability metadata without saving it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Comment on lines +187 to +189
for (const schema of layout.unsupported) {
if (schema.required) missing.push(schemaTitle(schema));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Incorrect missing-entry detection in missingSignInSetup marks every unsupported required schema as missing without checking for a saved global config entry, causing ProviderPanel to disable Turn on even after configuration on the linked plugin page. Preserve saved-entry presence checks for unsupported schemas and report only required entries that have not been saved.

Prompt for LLM

File web/src/pages/admin-settings/signInSetup.ts:

Line 187 to 189:

Incorrect missing-entry detection in missingSignInSetup marks every unsupported required schema as missing without checking for a saved global config entry, causing ProviderPanel to disable Turn on even after configuration on the linked plugin page. Preserve saved-entry presence checks for unsupported schemas and report only required entries that have not been saved.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 816114e. An entry the page can't render now records whether it has a saved value, and missingSignInSetup reports a required one only while nothing is saved. Covered in signInSetup.test.ts.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks—that addresses the reported issue: unsupported required entries should block Turn on only when no saved value exists. The regression coverage in signInSetup.test.ts covers that distinction.

I haven’t independently verified commit 816114e54.

Comment on lines +220 to +224
update(installation.id, (current) => {
const config = { ...current.config };
delete config[key];
return { ...current, config };
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug critical

Race condition in draft cleanup deletes newer, unsaved values when an admin edits an entry in SignInConfigField while mutateAsync is pending, because successful config saves unconditionally delete the current draft. Delete the draft only if it still matches the submitted entryDraft snapshot, and apply the same protection to autoProvision cleanup.

update(installation.id, (current) => {
  if (current.config[key] !== entryDraft) return current;
  const config = { ...current.config };
  delete config[key];
  return { ...current, config };
});
Prompt for LLM

File web/src/pages/admin-settings/useSignInProviderDrafts.ts:

Line 220 to 224:

Race condition in draft cleanup deletes newer, unsaved values when an admin edits an entry in SignInConfigField while mutateAsync is pending, because successful config saves unconditionally delete the current draft. Delete the draft only if it still matches the submitted entryDraft snapshot, and apply the same protection to autoProvision cleanup.

Suggested Code:

update(installation.id, (current) => {
  if (current.config[key] !== entryDraft) return current;
  const config = { ...current.config };
  delete config[key];
  return { ...current, config };
});

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 816114e. A successful save drops an entry's draft only if it is still the draft that was sent; an edit made while the write was in flight stays staged. Account creation gets the same check. Covered by "keeps an edit made while its entry was saving".

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks—based on your description, the fix in 816114e54 addresses this race for both config entries and account creation. The snapshot check preserves edits made while a save is in flight, and the regression test covers that scenario. No further changes requested for this finding.

Comment on lines +228 to +233
const binding = authBindingOf(installation);
await updateBinding.mutateAsync({
installationId: installation.id,
body: {
capability_id: capability.id,
enabled: binding?.enabled ?? false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug critical

Race condition in auto-provision saves can undo Turn off during a pending config save: the subsequent whole-row binding write sends enabled from the installation snapshot captured before the asynchronous config saves, and RuntimeConfigStore.UpsertAuthBinding overwrites enabled. Serialize binding changes with the page save or prevent immediate binding changes through the independent mutation until the page save finishes.

Prompt for LLM

File web/src/pages/admin-settings/useSignInProviderDrafts.ts:

Line 228 to 233:

Race condition in auto-provision saves can undo Turn off during a pending config save: the subsequent whole-row binding write sends enabled from the installation snapshot captured before the asynchronous config saves, and RuntimeConfigStore.UpsertAuthBinding overwrites enabled. Serialize binding changes with the page save or prevent immediate binding changes through the independent mutation until the page save finishes.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 816114e. Binding writes now share a mutation key. Turn on and Turn off are disabled while the page save runs or another binding write is in flight, and Save is disabled while a binding write is in flight, so the whole-row write can no longer restore an older enabled. Covered by "holds Turn off while the page is saving" and "holds the save while a provider is being turned off".

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks—this addresses the reported race as described. Blocking Turn on/Turn off during the page save, and blocking Save while a binding write is in flight, prevents the stale whole-row write from undoing Turn off.

The two regression tests cover both orderings. I haven’t independently inspected 816114e54 or run the tests, but the reported fix resolves the concern.

A saved entry's draft is dropped only if no edit arrived while it was
saving, and the same holds for account creation. Turning a provider on
or off waits for the page save, and the save waits for a binding write,
since both write the whole binding row. A required entry the page can't
render no longer counts as missing once it has been saved.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 1 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers

@Quick104
Quick104 merged commit 13601f0 into main Oct 2, 2026
13 checks passed
@Quick104
Quick104 deleted the t3code/oidc-sso-auth-support branch October 2, 2026 19:54
Rhainland added a commit to Rhainland/silo-server that referenced this pull request Oct 2, 2026
The getDeviceLogin and pollDeviceLogin approvals belong to the change Silo-Server#1799
merged, so the contract check reports them as stale against the new base.
Rhainland added a commit to Rhainland/silo-server that referenced this pull request Oct 2, 2026
The two device-login approvals belong to the change Silo-Server#1799 merged, so the contract check reports them as stale against the new base.
Quick104 added a commit that referenced this pull request Oct 2, 2026
Adding a response enum value is breaking-class before the lock. Only the
web admin reads sign_in_mode, and this branch teaches it the value. The
approvals #1799 carried no longer match a change against main, so they go.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Quick104 added a commit that referenced this pull request Oct 3, 2026
…ins (#1828)

* feat(auth): sign in with network identity through network access plugins

A network access provider plugin whose auth_provider.v1 capability declares
the "network" mode (such as the Tailscale plugin) can sign in the owner of
the device a request came from, with no password and no browser, so a TV on
the tailnet signs in with one button.

The plugin stamps X-Silo-Ingress-Peer next to its ingress token; the
middleware strips it everywhere and records the peer only with a valid token.
The new signInWithNetworkIdentity and linkAccountIdentityWithNetwork
operations ask the plugin who the peer is (NetworkIdentityAuth) and reuse
account resolution, role sync and the provider re-check. listAuthProviders
offers the provider only to requests from its own overlay, with the owner's
name. One network binding may be on beside the one OIDC or LDAP binding.
The web login page, account Sign-in settings and admin Sign-in page gain the
matching controls.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(auth): refresh the network sign-in button when the plugin's rules change

Discovery cached a network provider's answer about a peer for 30 seconds per
installation, so after an admin changed who may sign in, the "Continue as"
button kept the old answer until the entry expired. Cache by provider
instance instead: the registry builds new instances on every binding or
plugin configuration change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* build: pin the plugin SDK commit that adds network identity sign-in

The server needs NetworkIdentityAuth and the "network" auth mode from the
SDK. Pin that commit until the SDK release that carries it is tagged, then
move to the tag.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(api): list the network sign-in routes in the media route manifest

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(auth): let the primary provider decide for accounts that also sign in by network

An account can hold an identity at the OIDC or LDAP provider and one at a
network provider. Both applied their managed role, so a disagreement flipped
the role and signed the account out at every sign-in and re-check, and a
network refusal revoked every session and API key the primary provider
still vouched for. The primary provider now decides: the network identity's
role is ignored, and its refusal ends only the sessions opened through it.

The docs and the admin Network sign-in section also say that a shared
device signs in with its owner's role and that relays must be tagged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* chore(contracts): approve the network value of sign_in_mode

Adding a response enum value is breaking-class before the lock. Only the
web admin reads sign_in_mode, and this branch teaches it the value. The
approvals #1799 carried no longer match a change against main, so they go.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(auth): keep the primary provider's refusal and credentials authoritative over network sign-in

Review follow-ups:
- While the account's OIDC or LDAP provider refuses it, network sign-in
  answers not_permitted, so the overlay cannot undo deprovisioning.
- A network provider that cannot re-check no longer deletes the API keys
  and Audiobookshelf sessions of an account the primary provider vouches for.
- A network identity never links to an account by email auto-match.
- signInWithNetworkIdentity declares 429.
- The login page hides the password form when a network provider is the
  only way in.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(auth): bound network discovery and keep network-only sign-in from passing the password-off guard

Review follow-ups:
- Discovery waits at most 2 seconds for the network plugin, so a hung
  plugin no longer stalls the provider list for the client's 10 seconds.
- A discovery cache miss drops expired answers, including those of a
  provider instance a registry rebuild replaced.
- Only network sign-ins look up the account's primary provider; OIDC and
  LDAP sign-ins no longer pay that query.
- The admin "Turn on a sign-in provider first" guard counts only the OIDC
  or LDAP provider: a network sign-in reaches only people on its network.
- The three binding writes on the Sign-in page share one helper and one
  account-creation default.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* build: pin the plugin SDK commit with network sign-in review fixes

Moves the silo-plugin-sdk pin to 01bb1456e098, which refuses a network
capability that does not serve CheckAccount and keeps network apart from
password and oauth2 modes. The pin still moves to the v0.23.0 tag before
merge.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(auth): re-check the primary refusal when opening a network session and share discovery lookups

Review follow-ups:
- NetworkSignIn reads the primary provider's refusal again under the
  account lock while opening the session. A re-check that refuses the
  account holds that lock, so a refusal committed after account
  resolution no longer lets a fresh network session through.
- Concurrent discovery misses for one peer share one plugin call, so an
  overlay client cannot multiply plugin calls by sending parallel
  listAuthProviders requests.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(auth): honor pending primary refusals and bound the whole network preview lookup

A primary-provider refusal whose revocation rolled back stays only in
pending_refusal, so primaryAuthorityOf now reads it too: network sign-in
and network sessions are refused while it is pending.

Discovery's 2-second bound covered only the plugin call, not loading the
plugin client (an installation read), so a stalled load held the shared
lookup without a deadline. The timeout now wraps the whole shared lookup.

The concurrent-lookup test waits until every caller has missed the cache
before releasing the plugin, so it fails without the shared lookup.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(auth): signal network preview callers after they join the shared lookup

The test hook fired before singleflight.Do, so a caller could still be
outside the shared lookup when the test released the plugin. The preview
now uses DoChan, which registers the caller before returning, and the hook
runs after it, so every caller has joined the in-flight lookup before the
plugin answers.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(auth): refuse empty network peer answers and a second auth binding from one installation

A plugin answering AuthenticatePeer with neither a response nor an error
made network sign-in and linking panic before resolve could refuse it.

Enabling a network binding beside the same installation's primary binding
was allowed because the one-provider check compared only kinds. Identities
and account rechecks are keyed by installation, so one installation now
enables at most one auth binding.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(auth): re-check the primary identity of accounts with live network sessions

A refresh of a network session re-checks only the network identity, and
the scheduled pass picked a primary identity only for API keys,
Audiobookshelf sessions, or sessions opened through it. An account whose
only credentials were network sessions therefore never had its OIDC or LDAP
identity re-checked, so removal at the primary provider never ended those
sessions or blocked new network sign-ins.

The scheduled pass now also picks a primary identity while its account has
a live session opened through a network identity.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* build: pin the plugin SDK to v0.23.0

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
blurbery added a commit to blurbery/silo-server that referenced this pull request Oct 4, 2026
- Replace the fork's consumed Silo-Server#1534 breaking-change approvals with upstream's
  own records for the changes this sync brings in: the device sign-in
  canceled status (Silo-Server#1799) and invitation links without email delivery
  (Silo-Server#1788, approved as Silo-Server#1390). The fork's gate compares against the
  pre-sync fork main, so it still sees them.
- Give each fork row in the sample-entry admission table its own expected
  rejection. Upstream's Silo-Server#1869 now asserts its rows' message; the fork's
  extra rows are rejected by the fork's more specific checks.
- Type the incomplete person in the person page test as a real Person
  instead of casting a number id and a null birth date.
- Drop the two season plugin notice tests from the Silo-Server#700 draft; upstream's
  final Silo-Server#700 folded the same assertions into the image selection test.
- Fix changed-line lint on inherited upstream code: reuse the If-None-Match
  and header parameter constants, and name the image cache provider and
  content-type strings and the auto subtitle sync off value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant