Skip to content

feat: serve the admin console from FastAPI and Django - #4

Merged
Bccorb merged 2 commits into
mainfrom
feat/console-proxy
Oct 8, 2026
Merged

Bccorb merged 2 commits into
mainfrom
feat/console-proxy

Conversation

@Bccorb

@Bccorb Bccorb commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Adds the admin console proxy, the counterpart of the Express and Fastify ones. It lets a Python API serve the Seamless admin dashboard at /console on its own origin. seamless init defaults to the console served by the API, so the FastAPI API template (fells-code/seamless-templates#112) needs this.

  • Core: Adapter.console(method, path, query), blocking and thread-safe like handle.
  • FastAPI: app.include_router(console_router(auth)) serves /console and /console/....
  • Django: path("console/", include(console_urlpatterns)). The view is CSRF-exempt because it serves GET and HEAD only and answers anything else 405 itself.

Behaviour matches the Node proxies, fells-code/seamless-auth-go#3 and fells-code/seamless-auth-rust#4:

  • GET and HEAD only.
  • Only the method and path are forwarded, so the browser's cookies never reach the upstream.
  • Only content-type, cache-control, etag and last-modified come back.
  • A 10 second timeout, and 502 when the upstream is unreachable.
  • Literal or encoded dot segments, encoded / or \\, and malformed escapes answer 400.
  • Redirects are followed by hand on the adapter's no-redirect client, and only while they stay inside the console on the auth API's origin (at most 5).

Checked against a real auth API serving the dashboard (the verify stack): /console, /console/ and its hashed JS (1.3 MB) and CSS assets come through byte for byte, HEAD has no body, and a traversal is refused. I ran the same check against the Go and Rust proxies.

159 tests pass on Python 3.11, 3.12 and 3.14, and ruff and mypy strict are clean.

Bccorb added 2 commits October 8, 2026 15:19
Proxies the Seamless admin dashboard from the auth API at /console, as the
Express and Fastify adapters do: Adapter.console in the core, console_router
for FastAPI and console_urlpatterns for Django. GET and HEAD only, nothing
forwarded but the method and path, no path that can leave the console subtree,
and redirects followed only within it.
@Bccorb
Bccorb force-pushed the feat/console-proxy branch from b592bc8 to 907d3ee Compare October 8, 2026 19:19
@Bccorb
Bccorb merged commit 2f522be into main Oct 8, 2026
6 checks passed
@Bccorb
Bccorb deleted the feat/console-proxy branch October 8, 2026 20:06
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.

1 participant