diff --git a/docs/reference/agent-lessons/codex-prod-siwe-domain-config.md b/docs/reference/agent-lessons/codex-prod-siwe-domain-config.md new file mode 100644 index 000000000..636c1383a --- /dev/null +++ b/docs/reference/agent-lessons/codex-prod-siwe-domain-config.md @@ -0,0 +1,18 @@ +# Agent Lessons: codex-prod-siwe-domain-config + +Task: Fix production SIWE domain configuration and prevent www/apex drift. +Status: Active + +## Push Review + +## Lessons + +### Lesson: SIWE app URL must match the browser origin exactly + +- Domain: prod-config +- Severity: warning +- Trigger: Production MetaMask login showed an asset-risk warning because the Gateway SIWE challenge used `https://www.synapse-network.ai` while the user-facing origin was `https://synapse-network.ai`. +- Root cause: Cloud Run runtime drift and deploy defaults mixed `www` and apex production hosts. +- Fix: Update production runtime immediately, change the prod deploy default to the apex host, and document `PUBLIC_APP_BASE_URL=https://synapse-network.ai` in prod examples. +- Rule: Wallet login challenge domain, SIWE URI host, and browser origin must be identical per environment. +- Upgrade: agents-memory diff --git a/scripts/deploy/gcp_env.sh b/scripts/deploy/gcp_env.sh index b5caea772..d374592f8 100644 --- a/scripts/deploy/gcp_env.sh +++ b/scripts/deploy/gcp_env.sh @@ -55,7 +55,7 @@ synapse_load_gcp_env() { export ADMIN_FRONT_HOST="${ADMIN_FRONT_HOST:-admin.synapse-network.ai}" export ADMIN_API_HOST="${ADMIN_API_HOST:-admin-api.synapse-network.ai}" export DOCS_HOST="${DOCS_HOST:-docs.synapse-network.ai}" - export USER_FRONT_HOST="${USER_FRONT_HOST:-www.synapse-network.ai}" + export USER_FRONT_HOST="${USER_FRONT_HOST:-synapse-network.ai}" export TX_EXPLORER_BASE_URL="${TX_EXPLORER_BASE_URL:-https://arbiscan.io}" export PUBLIC_RPC_URL="${PUBLIC_RPC_URL:-https://arb1.arbitrum.io/rpc}" export USER_FRONT_CONTRACT_CONFIG_SOURCE="${USER_FRONT_CONTRACT_CONFIG_SOURCE:-src/contract-config.arbitrum-one.prod.json}" diff --git a/services/gateway/.env.prod.example b/services/gateway/.env.prod.example index 72394bd4b..e4361175c 100644 --- a/services/gateway/.env.prod.example +++ b/services/gateway/.env.prod.example @@ -108,6 +108,13 @@ GMAIL_SMTP_USERNAME=alerts@synapse.example GMAIL_SMTP_APP_PASSWORD=replace-with-google-app-password EMAIL_FROM="Synapse Network " EMAIL_REPLY_TO=support@synapse.example + +# Public URLs used in emails, receipts, and SIWE login challenges. +# Keep PUBLIC_APP_BASE_URL host identical to the browser origin. Do not use +# https://www.synapse-network.ai unless the user-facing app is also served from +# that exact host, or wallets may show a domain-mismatch security warning. +PUBLIC_GATEWAY_BASE_URL=https://api.synapse-network.ai +PUBLIC_APP_BASE_URL=https://synapse-network.ai EMAIL_SEND_TIMEOUT_SEC=10 EMAIL_WORKER_BATCH_SIZE=50 EMAIL_OUTBOX_MAX_ATTEMPTS=8 diff --git a/services/user-front/.env.prod.example b/services/user-front/.env.prod.example index cdea4a76b..79977790b 100644 --- a/services/user-front/.env.prod.example +++ b/services/user-front/.env.prod.example @@ -3,6 +3,7 @@ NEXT_PUBLIC_ANALYTICS_ENDPOINT=https://gateway.your-domain.example/api/v1/events NEXT_PUBLIC_SERVICE_LIST_CACHE_TTL_MS=20000 NEXT_PUBLIC_APP_ENV=prod NEXT_PUBLIC_DOCS_BASE_URL=https://docs.synapse-network.ai +NEXT_PUBLIC_CONSOLE_BASE_URL=https://synapse-network.ai/dashboard/overview NEXT_PUBLIC_TX_EXPLORER_BASE_URL=https://arbiscan.io NEXT_PUBLIC_SUPPORT_EMAIL=support@your-domain.example NEXT_PUBLIC_SUPPORT_PORTAL_URL=