Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(oauth2): allow Cursor cloud MCP OAuth callback in DCR allowlist (#20515)

Danny Xuf9e040507932
diff --git a/backend/api/oauth2/oauth2.go b/backend/api/oauth2/oauth2.go
index 23f5246002..89b84d7c45 100644
--- a/backend/api/oauth2/oauth2.go
+++ b/backend/api/oauth2/oauth2.go
@@ -231,6 +231,11 @@ func isAllowedHostedRedirectURI(u *url.URL) bool {
case "antigravity.google":
// Google Antigravity.
return u.Path == "/oauth-callback"
+ case "www.cursor.com":
+ // Cursor IDE and Cursor CLI (cursor-agent) route MCP OAuth through this
+ // fixed cloud callback. The cursor:// scheme above predates this flow and
+ // is no longer used for DCR, so the scheme entry alone doesn't help.
+ return u.Path == "/agents/mcp/oauth/callback"
default:
return false
}
diff --git a/backend/api/oauth2/oauth2_test.go b/backend/api/oauth2/oauth2_test.go
index 4e6a18c91b..41ba42e7cd 100644
--- a/backend/api/oauth2/oauth2_test.go
+++ b/backend/api/oauth2/oauth2_test.go
@@ -54,6 +54,17 @@ func TestIsAllowedDynamicClientRedirectURI(t *testing.T) {
{name: "antigravity callback", uri: "https://antigravity.google/oauth-callback", want: true},
{name: "antigravity wrong path", uri: "https://antigravity.google/evil", want: false},
+ // Cursor IDE / cursor-agent CLI — fixed cloud MCP OAuth callback.
+ {name: "cursor.com callback", uri: "https://www.cursor.com/agents/mcp/oauth/callback", want: true},
+ {name: "cursor.com explicit port 443", uri: "https://www.cursor.com:443/agents/mcp/oauth/callback", want: true},
+ {name: "cursor.com over http", uri: "http://www.cursor.com/agents/mcp/oauth/callback", want: false},
+ {name: "cursor.com wrong path", uri: "https://www.cursor.com/something-else", want: false},
+ {name: "cursor.com bare host", uri: "https://cursor.com/agents/mcp/oauth/callback", want: false},
+ {name: "cursor.com subdomain spoof", uri: "https://www.cursor.com.evil.com/agents/mcp/oauth/callback", want: false},
+ {name: "cursor.com userinfo spoof", uri: "https://[email protected]/agents/mcp/oauth/callback", want: false},
+ {name: "cursor.com dot-segment traversal", uri: "https://www.cursor.com/agents/mcp/oauth/callback/../evil", want: false},
+ {name: "cursor.com non-default port", uri: "https://www.cursor.com:8443/agents/mcp/oauth/callback", want: false},
+
// Arbitrary HTTPS / HTTP must stay rejected (the #20033 protection).
{name: "arbitrary https", uri: "https://evil.com/callback", want: false},
{name: "non-localhost http", uri: "http://evil.com/callback", want: false},