Skip to content

Fix SSO behind Cloudflare and stale dashboard assets after upgrade - #201

Merged
MacNite merged 2 commits into
mainfrom
claude/affectionate-ramanujan-ogyyck
Oct 6, 2026
Merged

MacNite merged 2 commits into
mainfrom
claude/affectionate-ramanujan-ogyyck

Conversation

@MacNite

@MacNite MacNite commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Two fixes found while setting up authentik SSO on a deployment behind Cloudflare.

OIDC client sends a HiveHub User-Agent

server/oidc.py used urllib without a User-Agent, so every call to the identity provider went out as Python-urllib/3.x. Cloudflare's Browser Integrity Check rejects that signature (error 1010, browser_signature_banned), so "Sign in with authentik" failed before the discovery document could even be fetched:

SSO login could not start: https://auth.…/application/o/hivehub/.well-known/openid-configuration returned HTTP 403: … Error 1010: Access denied …

Discovery, token and JWKS requests now send User-Agent: HiveHub/<SERVER_VERSION> (OpenID Connect client).

Dashboard assets revalidate on every load

The dashboard's JS/CSS were served with Cache-Control: public, max-age=3600, but their URLs are not versioned. After an upgrade, browsers (and CDNs in front, which public allows) kept serving the previous release's app.js — here a login page without the SSO button although /api/v1/local/auth/status already reported sso.enabled: true. All dashboard files are now no-cache: the copy stays cached, but is revalidated by ETag (unchanged files cost a 304), so a deploy shows up on the next load.

Testing

  • pytest test-data/test_oidc_sso.py: 23 passed.
  • Checked against a local HTTP server that _http_json sends the new User-Agent. Not tested against Cloudflare itself (the test environment could not reach the real host).
  • Checked with Starlette's TestClient that index.html, sw.js, assets/app.js and assets/style.css return Cache-Control: no-cache, and that a conditional request with the ETag returns 304.

Deployments that already serve the old app.js from a CDN cache still need one cache purge after upgrading.

🤖 Generated with Claude Code

https://claude.ai/code/session_018Rdb1HFXbXk2xeKrJkzdvb


Generated by Claude Code

claude added 2 commits October 6, 2026 07:05
…hour

The asset URLs are not versioned, so Cache-Control: public, max-age=3600
kept browsers (and CDNs in front) on the previous release's app.js after
an upgrade - e.g. the login page showed no SSO button although the server
reported SSO as enabled. Serve everything no-cache; unchanged files cost
an ETag 304.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Rdb1HFXbXk2xeKrJkzdvb
urllib's default Python-urllib/3.x is rejected by Cloudflare's Browser
Integrity Check (error 1010), so SSO could not even fetch the discovery
document when authentik sits behind Cloudflare.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Rdb1HFXbXk2xeKrJkzdvb
@MacNite
MacNite merged commit 74c322a into main Oct 6, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants