Repository navigation
OAuth connections act as the person who signed in - #13
Conversation
OAuth tokens used to be swapped for a single stored admin key, so every connection had admin rights whoever approved it. A connection is now a grant that names the person; each request loads their current role, and the shared key is gone (removed from the database at startup). - /mcp calls the REST API in-process as the caller. No credential is held by a session or crosses a socket, and each MCP session is bound to the credential that opened it. - Tokens are bound to this server's /mcp resource. OAuth tokens are no longer accepted at /api/v1, and /mcp no longer accepts a cookie. - Authorization codes and refresh tokens are atomically single-use. A replayed refresh token ends the connection. /oauth/revoke works. - Client registration is rate limited and limited in size; redirects must be https or loopback. The consent page says who the app will act as and where the browser goes next. - An API key is refused if its owner is disabled or can't be loaded. Only a key with no owner on record is adopted, and it keeps its limits. - Requests that set `published` now need content.publish. - Agent work is recorded as agent work with a server-generated session, and the audit log names the key or connection. - Asset uploads no longer read paths on the server's disk. The /api/v1 route table moves to internal/handlers so tests can walk it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Reverting to a version, or restoring a deleted page, that changes whether a live page is published now needs content.publish. - One active grant per person and client is enforced by a unique partial index; a racing second approval reuses the first grant. - A used refresh token is excused only within 10 seconds of rotation. - Access tokens never begin with "lc_", which marks an API key. - The consent page no longer points at a page that doesn't exist yet. - Session binding is tested for GET and DELETE as well as POST. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent review (a different model) found: version revert and restore could change what is published without |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Why
OAuth access tokens were swapped for one stored admin API key before reaching the MCP tools, so every OAuth connection had admin rights whoever approved it. This is the first of three changes that tie agent access to a person, enforce the agent sandbox on the server, and make merging an agent's own fork an explicit permission.
What changes
Identity
/mcpcalls the REST API in-process as the caller. No credential is held by a session or sent over a socket, and the MCP SDK's session check binds each session to the credential that opened it.Tokens and endpoints
/mcpresource only (RFC 8707). A request naming another resource is refused, and one naming none gets/mcp./api/v1, where they already ended in 403./mcpno longer accepts a browser cookie./oauth/revokeworks (RFC 7009) and requires the client's credentials.httpsor loopbackhttpredirects. The same rules apply to clients registered earlier.Roles hold
publish_newall needcontent.publish.POST /api/v1/assetsno longer reads afile_pathon the server. The hosted MCP endpoint'supload_assetno longer reads the server's disk; the stdio binary still reads local files.Records
/mcpare recorded as agent changes with a server-generated agent session. The audit log names the API key or connection used.The
/api/v1route table moves fromcmd/server/main.gotointernal/handlers/api_routes.go, so tests can walk the real routes.Upgrade note
Existing OAuth connections have to sign in again once. API keys are unaffected.
Tests
New tests cover the credential resolver, the OAuth grant lifecycle, concurrent code and refresh exchanges, replay, revocation, consent binding, the in-process MCP transport and session binding, publish permission on every path above, and an end-to-end run through
/mcpwith real tokens. In that run a viewer can read but not write, an editor can't change site configuration, a revoked connection stops mid-session, and changes are attributed to the agent and the connection.go test -p 1 ./...passes.🤖 Generated with Claude Code