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(auth): allow OAuth callbacks to www.macro.com (#8056)

gbirman4f83b18b66fc
diff --git a/docs/AGENT_GUIDE/login.md b/docs/AGENT_GUIDE/login.md
index 88ae91f346..dea35dbc27 100644
--- a/docs/AGENT_GUIDE/login.md
+++ b/docs/AGENT_GUIDE/login.md
@@ -21,6 +21,10 @@
failure does not block the remaining content; signup retries repair tags
without resetting task priorities. The guide waits until its tag IDs resolve.
+Production Google/SSO and inbox/calendar connections may return to either
+`https://macro.com` or `https://www.macro.com`. Verify connections from both hosts;
+the inbox link flow returns to `/app/inbox-link-callback` on the originating host.
+
## Temporary open signup in Develop
Once the temporary authentication-service override is deployed, Develop accepts
diff --git a/services/authentication_service/src/api/login/sso.rs b/services/authentication_service/src/api/login/sso.rs
index bc763c3f9f..6619c973cf 100644
--- a/services/authentication_service/src/api/login/sso.rs
+++ b/services/authentication_service/src/api/login/sso.rs
@@ -43,7 +43,7 @@ pub(crate) fn is_allowed_original_url(url: &Url) -> bool {
"http" => matches!(url.host_str(), Some("localhost" | "tauri.localhost")),
"https" => matches!(
url.host_str(),
- Some("localhost" | "tauri.localhost" | "dev.macro.com" | "macro.com")
+ Some("localhost" | "tauri.localhost" | "dev.macro.com" | "macro.com" | "www.macro.com")
),
_ => false,
}
diff --git a/services/authentication_service/src/api/login/sso/tests.rs b/services/authentication_service/src/api/login/sso/tests.rs
index 199af73e5f..19a0da4152 100644
--- a/services/authentication_service/src/api/login/sso/tests.rs
+++ b/services/authentication_service/src/api/login/sso/tests.rs
@@ -20,6 +20,7 @@ fn allowed_original_urls_are_accepted() {
"https://localhost/app/login",
"https://dev.macro.com/app/login",
"https://macro.com/app/login",
+ "https://www.macro.com/app/login",
] {
let original_url = Url::parse(original_url).expect("test URL should parse");
assert!(
@@ -34,8 +35,10 @@ fn untrusted_original_urls_are_rejected() {
for original_url in [
"https://example.com/app/login",
"https://macro.com.example.com/app/login",
+ "https://www.macro.com.example.com/app/login",
"https://staging.macro.com/app/login",
"http://macro.com/app/login",
+ "http://www.macro.com/app/login",
"http://dev.macro.com/app/login",
"tauri://example.com/app/login",
"http://127.0.0.1:3000/app/login",
diff --git a/services/authentication_service/src/api/oauth2/test.rs b/services/authentication_service/src/api/oauth2/test.rs
index ba52e023f1..cd3dc4e2ea 100644
--- a/services/authentication_service/src/api/oauth2/test.rs
+++ b/services/authentication_service/src/api/oauth2/test.rs
@@ -8,6 +8,7 @@ fn callback_original_url_allows_trusted_destinations() {
"http://localhost/app/login",
"https://dev.macro.com/app/login",
"https://macro.com/app/login",
+ "https://www.macro.com/app/inbox-link-callback",
] {
assert!(
validate_original_url(Some(original_url)).is_ok(),
@@ -21,7 +22,9 @@ fn callback_original_url_rejects_untrusted_destinations() {
for original_url in [
"https://evil.example.com/phish",
"https://macro.com.example.com/phish",
+ "https://www.macro.com.example.com/phish",
"http://macro.com/phish",
+ "http://www.macro.com/phish",
"javascript:alert('redirected')",
] {
assert!(
@@ -36,6 +39,9 @@ fn callback_original_url_rejects_untrusted_destinations() {
#[test]
fn callback_original_url_validates_decoded_destination() {
+ let trusted_url = urlencoding::encode("https://www.macro.com/app/inbox-link-callback");
+ assert!(validate_original_url(Some(&trusted_url)).is_ok());
+
let encoded_url = urlencoding::encode("https://evil.example.com/phish");
assert!(matches!(