Repository navigation
JITSU-265: read-only MCP access and a consent warning (stacked on JITSU-264) - #1607
Merged
Merged
Conversation
sahiltyagi-jitsu
marked this pull request as ready for review
October 27, 2026 07:43
sahiltyagi-jitsu
force-pushed
the
fix/jitsu-265-mcp-scopes
branch
from
October 27, 2026 12:28
d4919e0 to
67b57bf
Compare
Anyone can register an OAuth client under any name, so the name on the consent page proves nothing. It is now labelled as unverified, and a warning names the host that will receive access when the redirect URI is not loopback. Not covered: MCP scopes, a registration allowlist and shorter refresh token lifetime. JITSU-265
The consent page has a read-only choice; the code, the refresh token and the access token then carry the analyst role, so an MCP client cannot create, change, delete or run anything even if the user is an owner. Personal API keys used through MCP now also bring their workspace scope and role limit (they were only enforced on the REST API). Without the choice nothing changes. Builds on the key scoping of JITSU-264. JITSU-265
auth.extra is optional on AuthInfo; the CI typecheck caught it and my local check only looked at non-test files. JITSU-265
Sync runs, cancels, state resets, source checks and function runs were guarded by verifyAccess only, so they ignored the token's role.
sahiltyagi-jitsu
force-pushed
the
fix/jitsu-265-mcp-scopes
branch
from
October 29, 2026 07:15
155b599 to
2b55663
Compare
sahiltyagi-jitsu
dismissed
jitsu-code-review[bot]’s stale review
November 12, 2026 12:17
The base branch was changed.
There was a problem hiding this comment.
Review of 9516ca00183f38226fb9fc87f9aca9fa435d613b
Reviewed the full diff and relevant authorization paths. No high-confidence actionable defects found. Redirect helper assertions passed; full test suites were unavailable because dependencies are not installed.
Contributor
|
🚀 |
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.
JITSU-265(audit finding 2, High). Part ofJITSU-250. Builds on theJITSU-264PR (it uses the keyroleandworkspaceId), which is merged and released in consolebeta.110. This PR targetsnewjitsu; the branch needs an update fromnewjitsubefore it merges.Problem
MCP accepted an OAuth token or a personal API key with no scopes. Anyone can register an OAuth client under any name, and one Approve click gave the client the full account (MCP tools create and delete configs and run code).
Change
analystrole, so the client can read but not create, change, delete or run anything, even for an owner. It is off by default, so existing connections work as before.JITSU-264PR, where the limits are introduced.Verified
Each fix has tests that fail on the code before it.
mcp-readonly.test.ts(10 tests, real Postgres) drives the real flow: register, approve withread_only, token exchange, refresh, access token. The role survives refresh, and without the choice nothing changes. Five tests (reset_sync_state,run_sync,cancel_sync,check_source_credentials,run_function) check that a read-only token gets a 403; for the four sync tools they also check that the service is not called. They fail without the tool guard. The approving step runs as a signed-in session, because approving with an API key is refused in theJITSU-264PR. All 10 pass on the current head.oauth-redirect.test.ts).https://evil.example/cbthe name is labelled "chosen by the client, not verified" and the warning namesevil.example; forhttp://localhost:6274/...there is no warning. Approve with the Read-only box ticked sendsread_only: true; the server returns 200 and the token exchange works. The stored refresh token has roleanalyst; approving without the box stores no role.Behaviour change for API keys with the
analystroleThe tool guard applies to any token whose role cannot edit, so a personal API key with role
analystis now refused the 12 non-read-only tools on MCP too, includingrun_sync,cancel_syncandcheck_source_credentials. Before, those calls checked only workspace access. REST is unchanged: the same key can still run a sync there (sources/run). Theanalystrole was added in theJITSU-264PR, so keys with it have existed only sincebeta.110.Rollback and rolling deploy
role = analyston the connection's refresh-token row, and only this PR reads it on the OAuth path. If the console is rolled back to a build without this PR, every connection approved as read-only keeps working with no limit until the PR is deployed again.Not verified / not done
JITSU-287).discover_streams,check_source_credentials,test_connection,run_function), which matches the consent page text.