fix(web-app-jellyfin): give the SSO client the onion treatment

The plugin configuration never sent DisableHttps. Upstream builds the discovery policy as options.Policy.Discovery.RequireHttps = !config.DisableHttps, and the property defaults to false, so RequireHttps stayed on and IsSecureScheme refused http://auth.<onion>/realms/... with "HTTPS required" before a socket was opened. GET /sso/OID/start/Keycloak answered 500 and the browser never left Jellyfin. The key appeared nowhere in this repository.

Behind that sat a second hole. The compose template never called container_extra_hosts, whose own documentation describes exactly this situation: the OIDC endpoints handed to an application on an onion deployment are public onion authorities, right for the browser that reaches them through Tor and unroutable for the server-side calls the application makes itself. Around fifty role templates carry that pin. This one did not, so the code-to-token exchange would have failed next.

Third, SchemeOverride was hardcoded to https. plugins/lookup/redirect_uris.py:125-126 records that the registered redirect URI is always plaintext for an onion and never follows the TLS state of Keycloak, so the hardcoded value would have minted a callback Keycloak has not registered. It now follows the vhost through lookup(tls, application_id, protocols.web), and DisableHttps follows the scheme of the issuer itself rather than the TLS state of Keycloak, because OIDC_OVERRIDE.URL can replace it.

On relaxing the https requirement: it is derived, not blanket. On clearnet the issuer is https, so the value renders false and protocols.web renders https, which is byte-identical to the previous hardcode; the clearnet delta is zero. Where it does apply, the onion is itself the transport encryption, and the extra-hosts pin sends the back-channel over the local network to the proxy that already serves the vhost, so no token crosses a plaintext public path.

Plaintext onion SSO is the normal case here, not an edge: 94 variants across the fleet pin sso and tor together and tests/lint/ansible/roles/meta/test_sso_variant_requires_tor.py makes that a written contract. Jellyfin was simply the one SSO role that never received the idiom. What remains unproven is the browser half after discovery succeeds, which one onion run of addons/sso-authentication.spec.js settles.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-10-21 16:34:54 +02:00
1 parent 6d8fb54adb
commit fd7f001046
3 files changed
+5 -1

No files matched your search

@@ -207,7 +207,8 @@ if [ -n "${TOKEN:-}" ] && [ "${JELLYFIN_SSO_ENABLED}" = "true" ]; then
"OidScopes": ["openid", "profile", "email"],
"DefaultUsernameClaim": "preferred_username",
"DisablePushedAuthorization": true,
"SchemeOverride": "https"
"DisableHttps": ${JELLYFIN_OIDC_DISABLE_HTTPS},
"SchemeOverride": "${JELLYFIN_WEB_PROTOCOL}"
}
}
}
+2
View File
@@ -38,6 +38,8 @@
jellyfin_auth_env_sso:
JELLYFIN_SSO_PLUGIN_MANIFEST: "{{ JELLYFIN_SSO_PLUGIN_MANIFEST }}"
JELLYFIN_OIDC_ISSUER: "{{ JELLYFIN_OIDC_ISSUER }}"
JELLYFIN_WEB_PROTOCOL: "{{ lookup('tls', application_id, 'protocols.web') }}"
JELLYFIN_OIDC_DISABLE_HTTPS: "{{ (JELLYFIN_OIDC_ISSUER | urlsplit('scheme') != 'https') | string | lower }}"
JELLYFIN_OIDC_CLIENT_ID: "{{ JELLYFIN_OIDC_CLIENT_ID }}"
JELLYFIN_OIDC_CLIENT_SECRET: "{{ JELLYFIN_OIDC_CLIENT_SECRET }}"
jellyfin_auth_env: >-
@@ -9,6 +9,7 @@
{{ lookup('container_depends_on', application_id) | indent(4) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_extra_hosts') | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{% if JELLYFIN_MCP_ENABLED | bool %}