Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(mcp): trust www.cursor.com for MCP OAuth redirects and FusionAuth origins (#7935)

teo46836648947c
diff --git a/infra/stacks/fusionauth-instance/origins.ts b/infra/stacks/fusionauth-instance/origins.ts
index 80dedc2f57..733c64b894 100644
--- a/infra/stacks/fusionauth-instance/origins.ts
+++ b/infra/stacks/fusionauth-instance/origins.ts
@@ -27,6 +27,7 @@ export const ALLOWED_ORIGINS = () => {
'https://chatgpt.com',
'https://chat.openai.com',
'https://cursor.com',
+ 'https://www.cursor.com',
];
case 'dev':
return [
@@ -51,6 +52,7 @@ export const ALLOWED_ORIGINS = () => {
'https://chatgpt.com',
'https://chat.openai.com',
'https://cursor.com',
+ 'https://www.cursor.com',
];
case 'prod':
return [
@@ -66,6 +68,7 @@ export const ALLOWED_ORIGINS = () => {
'https://chatgpt.com',
'https://chat.openai.com',
'https://cursor.com',
+ 'https://www.cursor.com',
];
}
diff --git a/services/mcp_service/src/config.rs b/services/mcp_service/src/config.rs
index 15c84c7791..0d38d280d7 100644
--- a/services/mcp_service/src/config.rs
+++ b/services/mcp_service/src/config.rs
@@ -11,6 +11,9 @@ pub use macro_auth::InternalApiKey;
pub use macro_env::Environment;
use macro_env_var::{env_vars, maybe_env_vars};
+#[cfg(test)]
+mod test;
+
maybe_env_vars! {
/// Browser-reachable FusionAuth origin used for OAuth authorization redirects.
pub struct FusionauthPublicUrl;
@@ -32,8 +35,13 @@ maybe_env_vars! {
/// origins the FusionAuth application already allows. A host absent from this
/// list cannot be used as a redirect destination, which is what stops an
/// attacker from registering a client pointing at a callback they control.
-pub const DEFAULT_MCP_ALLOWED_REDIRECT_HOSTS: [&str; 4] =
- ["claude.ai", "chatgpt.com", "chat.openai.com", "cursor.com"];
+pub const DEFAULT_MCP_ALLOWED_REDIRECT_HOSTS: [&str; 5] = [
+ "claude.ai",
+ "chatgpt.com",
+ "chat.openai.com",
+ "cursor.com",
+ "www.cursor.com",
+];
env_vars! {
/// Auth key used by the document storage / search / lexical clients.
diff --git a/services/mcp_service/src/config/test.rs b/services/mcp_service/src/config/test.rs
new file mode 100644
index 0000000000..e09a0250fb
--- /dev/null
+++ b/services/mcp_service/src/config/test.rs
@@ -0,0 +1,11 @@
+use mcp_auth_proxy::domain::redirect_uri::RedirectUriPolicy;
+
+use super::*;
+
+#[test]
+fn default_redirect_hosts_permit_cursor_web_agent_callbacks() {
+ let policy = RedirectUriPolicy::new(DEFAULT_MCP_ALLOWED_REDIRECT_HOSTS);
+
+ assert!(policy.permits("https://cursor.com/agents/mcp/oauth/callback"));
+ assert!(policy.permits("https://www.cursor.com/agents/mcp/oauth/callback"));
+}