Per-account OAuth for remote deployments, with vendor-neutral sign-in pages - #2
Open
Rahulk644 wants to merge 3 commits into
Open
Per-account OAuth for remote deployments, with vendor-neutral sign-in pages#2Rahulk644 wants to merge 3 commits into
Rahulk644 wants to merge 3 commits into
Conversation
The sign-in and authorized pages hardcoded one deployment and one client: "Sign in to PREP Docs MCP", "Use your PREP Docmost account", and a button reading "Continue to Codex". This is a public MCP server and MCP is one protocol — Claude Code, Claude Desktop, Codex and Cursor all reach these pages, so anyone connecting from Cursor was told to continue to Codex. Branding is now `DOCMOST_MCP_BRAND` (default "Docmost"), trimmed and length capped. The client is named from the `client_name` it already supplied at dynamic registration and this server already stored but never used; clients that register without one get a generic label rather than a guess. The name is carried on the completed authorization too, so a refreshed browser replays the same page instead of a differently-worded one. `client_name` is self-declared, so it is untrusted input that lands in both a heading and a link label — it is escaped, with a test that fails on markup. Also: - docker-compose.production.yml referenced a private registry image nobody outside the org can pull; it now builds a local tag. - SECURITY.md described this as "a local fork" with no way to report anything. It now documents the two authentication modes as a table — including that enabling account OAuth makes the static bearer optional but not harmless — and points at GitHub private security advisories. 126 tests pass (+5): brand fallback and capping, generic client label, the escaping regression, a login page rendered under a custom brand, and per-account login throttling, which had no coverage at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings
mainin line with what is actually deployed, and removes the branding that made the OAuth pages unusable for anyone but one deployment.What this adds
A complete OAuth 2.1 authorization server (
src/oauth.rs), so a remote MCP endpoint can authenticate each user as themselves instead of sharing one credential:POST /api/auth/login— Community edition, no enterprise licence, no Docmost forkDOCMOST_MCP_BEARER_TOKENbecomes optional when account auth is on, and remains the break-glass path.Vendor neutrality
The pages previously read "Sign in to PREP Docs MCP" and offered a button labelled "Continue to Codex". MCP is one protocol — Claude Code, Claude Desktop, Codex and Cursor all reach these pages — so a Cursor user was told to continue to Codex.
DOCMOST_MCP_BRAND, defaultDocmost, trimmed and length-cappedclient_nameit supplied at registration, which this server already stored but never used; unnamed clients get a generic labelclient_nameis self-declared and lands in a heading and a link label, so it is escaped — with a test that fails on markup.Also fixed
docker-compose.production.ymlpointed at a private registry image nobody outside the org could pullSECURITY.mdcalled this "a local fork" and gave no way to report anything. It now documents both auth modes as a table — including that enabling account OAuth makes the static bearer optional but not harmless — and points at GitHub private security advisoriesVerification
fmtclean,clippy -D warningsclean, 126 tests pass (+5).The end-to-end test stands up a mock Docmost and runs two full authorization flows for different accounts, asserting the resulting tokens resolve to their own sessions. New coverage: brand fallback and capping, generic client label, the escaping regression, a login page under a custom brand, and per-account login throttling — which previously had none.
🤖 Generated with Claude Code