Skip to content

fix(jellycompat): send every field Jellyfin includes in the sign-in response - #3144

Merged
Quick104 merged 3 commits into
Silo-Server:mainfrom
Brady3035:fix/jellycompat-auth-response-fields
Oct 27, 2026
Merged

Quick104 merged 3 commits into
Silo-Server:mainfrom
Brady3035:fix/jellycompat-auth-response-fields

Conversation

@Brady3035

@Brady3035 Brady3035 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: changes #1246 C1 (adds fields to the sign-in response that Jellyfin Web, Findroid, and Jellyfin for Android TV read)

Lenna 1.0.17, an iOS Jellyfin and Emby client, cannot sign in to Silo. POST /Users/AuthenticateByName returns 200 with a token, but Lenna shows "JSON Decode Error: … The data couldn't be read because it is missing." That is Swift's error when a required key is absent, so Lenna discards the session.

Silo's sign-in response leaves out keys that Jellyfin always sends. This change adds them so strict decoders accept the response.

Approach

The compat sign-in response now carries every key Jellyfin's AuthenticationResult sends for a new session:

  • User.Policy sends its list fields as [] instead of omitting them, and gains AccessSchedules and BlockUnratedItems.
  • User gains EnableAutoLogin, LastLoginDate, and LastActivityDate.
  • SessionInfo gains Id, Client, DeviceId, DeviceName, ApplicationVersion, RemoteEndPoint, PlayState, Capabilities, AdditionalUsers, and NowPlayingQueue. The device fields come from the request's MediaBrowser authorization header. Id is derived from the user and device ID, never from the access token.

Lenna is closed source, so the exact key it requires is unknown. Matching Jellyfin's full response covers it without guessing. The same user DTO serves /Users/Me, /Users, and /Users/{id}, so those responses gain the same fields. The change is additive: no field is removed or changes meaning. No native API, Apple, or Android client change is needed.

Validation

  • go build, go vet, gofmt, make lint-changed, make lint-router-recovery, and make verify-local-paths pass.
  • make test-go passes except for five tests in metadata/nfo, scanner, and subtitles/subsync, which fail the same way on main on the macOS dev machine (filename case and non-UTF-8 name handling).
  • make verify-route-inventory and make verify-bidi could not run locally (cgo type-check and the local git grep regex); CI covers both. This change adds no routes.
  • A new jellycompat test asserts that the sign-in response carries each key and reads the device fields from the authorization header. It fails on main (23 missing keys) and passes with this change.
  • Web checks were not run; no web files changed.
  • Re-tested in Lenna against a build with this change.

Evidence

Evidence: none, no user-visible change in Silo's own apps. The visible effect is Lenna signing in; a screenshot will be added after testing against this build.

Before:
IMG_1975
Screenshot 2026-10-26 at 10 47 57 PM
Done on Build 3e2d306

After:
IMG_1976
Screenshot 2026-10-26 at 10 57 15 PM
Done on Build 3e2d306+dirty

Risks

None identified. Clients that ignore unknown keys see no difference. RemoteEndPoint echoes the caller's own address back to it, as Jellyfin does.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (Claude desktop app, Code tab)
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: n/a

Note

Send all Jellyfin-required fields in jellycompat sign-in response

  • Expands userDTOResponse, userPolicyResponse, and sessionInfoResponse with fields Jellyfin clients expect, serialized under Jellyfin JSON names. Adds a new clientCapabilitiesResponse type in handlers_auth.go.
  • sessionInfo now takes the request. It builds a stable session ID from the pseudo-user ID plus DeviceId (or login-session ID), populates client/device/version values from the authorization header, and fills play state and capabilities with defaults.
  • userDTO sets LastLoginDate from session creation time, LastActivityDate to now, and EnableAutoLogin to false. Policy slice fields serialize as empty arrays instead of being omitted.
  • Adds a test in handlers_auth_body_test.go that checks required response keys, header-derived values, and session ID stability.
  • Behavioral Change: sessionInfo drops hyphens from session IDs and generates a random UUID when no device ID or login-session ID is available.

Macroscope summarized a825f9e.

…esponse

Lenna and other clients with strict JSON decoders reject the
AuthenticateByName response when a key Jellyfin always sends is missing.
The response now includes the full policy lists, the user's login and
activity dates, and a complete SessionInfo with device details taken from
the MediaBrowser authorization header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Oct 27, 2026
@silo-kody

silo-kody Bot commented Oct 27, 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 ❌

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 734d1cbf-22c6-4c5c-befc-6a5e4b95b5d0
Commits

Reviewing files that changed from the base of the PR and between 4c09891 and a825f9e.

Files selected for processing: 2
  • internal/jellycompat/handlers_auth.go
  • internal/jellycompat/handlers_auth_body_test.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

Authentication responses now include additional user policy fields, login timestamps, and request-derived session metadata. Session IDs are based on the user and device ID when available, or on the user and login-session ID when available. Otherwise, a UUID is generated.

Changes: Authentication responses

Layer / File(s) Summary
User policy and timestamps
internal/jellycompat/handlers_auth.go
User responses include additional policy fields and login timestamps. Policy lists, including AccessSchedules, are initialized as empty slices. Login time uses the current time when the session creation time is zero.
Request-derived session details
internal/jellycompat/handlers_auth.go, internal/jellycompat/handlers_auth_body_test.go
Both authentication handlers pass the request to sessionInfo. Session responses include play state, capabilities, endpoint, and client and device metadata. Session IDs use the user and device ID when available, the user and login-session ID when available, or a generated UUID. Tests check required response fields, session metadata, and session ID behavior.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant AuthenticationHandler
  participant sessionInfo
  participant HTTPRequest
  AuthenticationHandler->>sessionInfo: Pass the request
  sessionInfo->>HTTPRequest: Read authorization metadata and endpoint
  sessionInfo-->>AuthenticationHandler: Return session metadata
Loading

Suggested labels: impact: usability

Suggested reviewers: quick104

Merge Risk: Minimal · up to a825f

The authentication response changes are mergeable after normal checks; no actionable risk remains established.

Security architecture risk: Low · up to a825f

The changes expand response data without changing how users authenticate or gain access. Device metadata remains descriptive, and the new session identifier is not an access credential. Remaining uncertainty concerns external client interpretation of the expanded contract.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The inspected response expansion remains scoped to the authenticated caller's account and profile. /Users returns only that caller's user, /Users/{id} rejects a different pseudo-user ID, and anonymous /Users/Public remains empty.

Trust Boundaries and Controls

  • observed — Client, device name, device ID, and version are caller-controlled descriptive fields. Authenticated identity and access tokens still come from the resolver. Production password sign-in retains its endpoint rate limiter and credential-validation path; the new response fields do not replace either control.

Resilience and Maintainability Implications

  • observed — The new response builder has no persistence side effects. Quick Connect collection retains transactional session persistence and request consumption, with consumed-secret retries recovering the existing session. A response failure can occur after session creation, but that ordering predates this PR; the added fields do not change authority, cleanup, or recovery.
Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title "fix(jellycompat): send every field Jellyfin includes in the sign-in response" matches the main change: the PR adds the keys Jellyfin always sends in the AuthenticateByName response (User.Po…
Description check Passed The description explains the problem (Lenna 1.0.17 fails sign-in with a JSON decode error because required keys are missing from the Jellyfin sign-in response), the approach (added User, Policy, and S…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(jellycompat): send every field Jellyfin includes in the sign-in response" matches the main change: the PR adds the keys Jellyfin always sends in the AuthenticateByName response (User.Policy list fields, User date and auto-login fields, and SessionInfo fields). It is specific and concise. The title is a little broad in saying "every field", but the PR body and objectives describe the same scope, so it is not misleading.

Full details: Description check

Explanation

The description explains the problem (Lenna 1.0.17 fails sign-in with a JSON decode error because required keys are missing from the Jellyfin sign-in response), the approach (added User, Policy, and SessionInfo fields, device fields read from the MediaBrowser header, stable session IDs), validation steps, and a new test. It is directly related to the changeset.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code impact: compat Breaks a supported client or server path priority: P2 Limited scope, workaround exists, or polish labels Oct 27, 2026
@coderabbitai coderabbitai Bot added the impact: usability Core flow broken or severely blocked label Oct 27, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6fef9d3-e347-42f3-b5a0-b10e079ee7f6
Commits

Reviewing files that changed from the base of the PR and between 3e2d306 and d08eb29.

Files selected for processing: 2
  • internal/jellycompat/handlers_auth.go
  • internal/jellycompat/handlers_auth_body_test.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread internal/jellycompat/handlers_auth.go Resolved
SessionInfo.Id was derived from the user and DeviceId, so every sign-in
that named no device returned the same Id for that user. Such a sign-in now
gets a random Id; sign-ins that name a device keep the stable one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Oct 27, 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 ❌

@macroscopeapp

macroscopeapp Bot commented Oct 27, 2026

Copy link
Copy Markdown

Major change — silo-server#1246 C1: The recorded matrix exercises sign-in with Jellyfin Web 12.1, Findroid 1.1.0, and Jellyfin for Android TV 0.19.10. This PR changes the User/Policy/SessionInfo payload returned by sign-in, so the earlier run on 31fabc723 plus #2934/#2935/#2970 does not cover the new response contract. The PR must explain why validated behavior changes; C1 needs re-validation after merge. Validation tasks: changes #1246 C1 is consistent with this impact.

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

Posted via Macroscope — v1 validation impact

@Brady3035

Copy link
Copy Markdown
Contributor Author

Should be ready to review. Thanks

…tries

A sign-in without a DeviceId got a random SessionInfo.Id, so asking
AuthenticateWithQuickConnect again with the same secret returned the same
session under a new Id. The Id now derives from the login session, which
the retry shares, and stays distinct between sign-ins.

The test drops a check that could never fail (a hex Id cannot contain
"tok"), and SyncPlayAccess uses a named constant instead of a nolint
comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review of 4c09891. The approach holds up: the sign-in response now matches Jellyfin's key set, and every new value fits the Kotlin and Swift SDK models I checked. Three small findings below, none blocking. I'm fixing all three in a commit on this branch, so there's no need to change anything yourself.

Comment thread internal/jellycompat/handlers_auth.go Resolved
Comment thread internal/jellycompat/handlers_auth.go Resolved
@silo-kody

silo-kody Bot commented Oct 27, 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 ❌

@Quick104

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: a825f9e (your 4c09891 plus one review-fix commit).

The change is sound. The sign-in response now carries the keys Jellyfin always sends, and the new values fit the Kotlin SDK models that Findroid and Jellyfin for Android TV use, as well as the Swift models. The policy lists are empty arrays, and PlayState and Capabilities carry their required fields. Every key is additive. The new sign-in test fails on main (23 missing keys) and passes on this branch.

Addressed in a825f9e

  • A sign-in without a DeviceId got a new random SessionInfo.Id every time, so a repeated Quick Connect exchange returned the same token under a different Id. The Id now derives from the login session. The test checks that a retry keeps its Id and that two sign-ins don't share one; that check fails on 4c09891.
  • Removed a test assertion that couldn't fail (a hex Id can't contain tok).
  • SyncPlayAccess uses a named constant instead of a nolint comment.

Left for maintainers (not blocking)

  • SessionInfo.Id doesn't match any Id that GET /Sessions returns. That endpoint lists playback mappings, and Silo has no /Sessions/{id} routes. Before this PR the field was missing entirely. None of the clients checked (Findroid, Jellyfin for Android TV) keep SessionInfo from sign-in.
  • User.LastLoginDate is the calling token's sign-in time, not the account's latest sign-in. An older token's /Users/Me reports its own sign-in time. Showing the account's latest sign-in would need a stored per-profile timestamp.

Validated features: changes #1246 C1, as the PR body says. C1's smoke matrix signs in with Jellyfin Web, Findroid, and Jellyfin for Android TV, and this PR changes the User, Policy, and SessionInfo payload they decode. The change is additive and the SDK models accept it, but C1 needs a re-test on the merged build.

Cross-provider review: one round with Codex (gpt-6.1-sol). It raised the two items above under Left for maintainers, plus the Quick Connect retry Id, which is fixed. It found no client-decoding, privacy, or multi-node problems.

User manual: unaffected. The Jellyfin apps page doesn't describe sign-in response fields. Adding Lenna to its list of checked apps can wait for a validated run.

Apple/Android parity: not applicable. This changes only the Jellyfin-compatible surface, and Silo's own apps don't use it.

Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)

  • Fit: Jellyfin compatibility is a long-term commitment, and this fixes sign-in for a strict client at the compat boundary with additive fields only.
  • Readiness: a test that fails on main covers the fix, the author's Lenna run shows it live, and the only open items are informational.

@Quick104
Quick104 merged commit c03b2c2 into Silo-Server:main Oct 27, 2026
22 checks passed
@Brady3035
Brady3035 deleted the fix/jellycompat-auth-response-fields branch November 3, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code impact: compat Breaks a supported client or server path impact: usability Core flow broken or severely blocked priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants