Files
openmotion/deploy/.env.example
open-design-crew[bot] 05a28737dc feat(auth): accept any public HTTPS redirect host in MCP OAuth DCR (#1172)
* feat(auth): accept any public HTTPS redirect host in MCP OAuth DCR

Web-hosted MCP clients such as Doubao were rejected with 400
invalid_client_metadata because dynamic client registration only admitted
a fixed list of HTTPS redirect hosts, so every new platform needed a code
change and a release.

- DCR accepts any public DNS HTTPS redirect host. IP literals, single-label
  and *.localhost hosts, fragments and userinfo stay rejected; loopback HTTP
  and native app schemes are unchanged.
- OAUTH_DCR_ALLOWED_HTTPS_HOSTS now marks verified hosts. The consent page
  shows a warning naming the host when the redirect host is not verified.
  The same list still gates browser Origin headers on /mcp.
- New OAUTH_DCR_BLOCKED_HTTPS_HOSTS rejects registration and cuts off
  already registered clients at authorize, code exchange and refresh.
- Each DCR registration and rejection is logged with its redirect hosts.

* fix(auth): reduce unverified redirect notice to one consent line

Replace the multi-sentence warning block with a warning badge and the
bold redirect host in the existing consent subtitle.

* fix(auth): canonicalize terminal-dot redirect hosts in DCR checks

URL.hostname keeps a terminal dot, so https://cb.phish.example./cb evaded
OAUTH_DCR_BLOCKED_HTTPS_HOSTS and https://localhost./cb passed the public
host check. Strip one terminal dot before verified, blocked and public-host
matching, reject hosts with empty labels, and derive the audit log's
unverified hosts from the parsed scheme so HTTPS:// spellings are counted.

---------

Co-authored-by: heggria <bshengtao@gmail.com>
2026-11-27 09:22:59 -08:00

162 lines
7.0 KiB
Plaintext

# OpenMotion local Docker Compose configuration (AUTH_MODE=dev, MODEL_GATEWAY_MODE=mock).
# Copy to deploy/.env before customizing: `cp deploy/.env.example deploy/.env`
# NEVER commit deploy/.env or real credentials to Git.
# -----------------------------------------------------------------------------
# Local container image tags & host loopback ports
# -----------------------------------------------------------------------------
OPENMOTION_API_IMAGE=openmotion-api:local
OPENMOTION_WORKER_MEDIA_IMAGE=openmotion-worker-media:local
OPENMOTION_WORKER_RENDER_IMAGE=openmotion-worker-render:local
OPENMOTION_CATALOG_SYNC_IMAGE=openmotion-catalog-sync:local
OPENMOTION_PORT=4173
PORT=4173
POSTGRES_PORT=5432
S3_API_PORT=9000
S3_CONSOLE_PORT=9001
# -----------------------------------------------------------------------------
# Core service settings (must match src/infra/config.ts)
# -----------------------------------------------------------------------------
NODE_ENV=development
APP_PUBLIC_ORIGIN=http://127.0.0.1:4173
# Optional cookie-less preview origin (e.g. https://preview.openmotion.example.com).
# Leave empty for single-host local Docker Compose development.
PREVIEW_PUBLIC_ORIGIN=
PREVIEW_TOKEN_TTL_SEC=900
LOG_LEVEL=info
PG_POOL_MAX=20
WORKER_PG_POOL_MAX=10
REDIS_MAXMEMORY=512mb
REDIS_CACHE_URL=
REDIS_CACHE_TTL_SEC=3600
# -----------------------------------------------------------------------------
# Local PostgreSQL & RustFS S3-compatible object storage (synthetic dev defaults)
# -----------------------------------------------------------------------------
POSTGRES_DB=openmotion
POSTGRES_USER=openmotion
POSTGRES_PASSWORD=openmotion_local_dev
S3_PUBLIC_ENDPOINT=http://127.0.0.1:9000
S3_REGION=us-east-1
S3_BUCKET=openmotion
S3_ACCESS_KEY_ID=openmotion
S3_SECRET_ACCESS_KEY=openmotion_local_dev
S3_FORCE_PATH_STYLE=true
S3_PRESIGN_PUT_TTL_SEC=900
S3_PRESIGN_GET_TTL_SEC=300
S3_PRESIGN_CACHE_WINDOW_SEC=3600
S3_CORS_ALLOWED_ORIGINS=
CATALOG_SYNC_FETCH_REMOTE=true
# -----------------------------------------------------------------------------
# Auth & Remote MCP (local dev bypass; production MUST use AUTH_MODE=oidc)
# -----------------------------------------------------------------------------
AUTH_MODE=dev
ALLOW_INSECURE_DEV_AUTH=false
DEV_WORKSPACE_ID=00000000-0000-4000-8000-000000000001
DEV_USER_ID=00000000-0000-4000-8000-000000000002
DEV_PAT=om_pat_devlocal_000000000000000000000000
TRUST_PROXY_HOPS=1
# Required only when AUTH_MODE=oidc (replace with real values outside Git).
# For OpenDesign / Vela Better Auth OIDC, set:
# OIDC_ISSUER=https://amr-api.open-design.ai/api/auth
# OIDC_CLIENT_SECRET=<first-party secret> (used for client_secret_post and HS256 ID tokens when disableJwtPlugin=true)
# MCP_OAUTH_MODE=proxy (recommended when upstream IdP disables DCR/refresh tokens)
# SESSION_SECRET=CHANGE_ME_SESSION_SECRET_MIN_32_CHARS
# OIDC_ISSUER=https://auth.example.com
# OIDC_CLIENT_ID=CHANGE_ME_OIDC_CLIENT_ID
# OIDC_CLIENT_SECRET=CHANGE_ME_OIDC_CLIENT_SECRET
# OIDC_CALLBACK_URL=http://127.0.0.1:4173/auth/callback
SESSION_SECRET=
OIDC_ISSUER=
OIDC_CLIENT_ID=
OIDC_CLIENT_SECRET=
OIDC_CALLBACK_URL=
OIDC_SCOPES=openid profile email
OIDC_CLAIM_SUB=sub
OIDC_CLAIM_EMAIL=email
OIDC_CLAIM_NAME=name
OIDC_CLAIM_WORKSPACE=
MCP_OAUTH_MODE=proxy
MCP_OAUTH_ISSUER=
# Maximum MCP JSON-RPC request body size in bytes (10 MiB)
MCP_MAX_BODY_BYTES=10485760
# MCP OAuth DCR accepts any public HTTPS redirect host (DNS name, no IP literal), loopback HTTP and
# RFC 8252 native app schemes; the consent page always shows the redirect host.
# Comma-separated verified HTTPS hosts (`*.` wildcards allowed): their redirects skip the consent-page
# warning, and they are the only HTTPS browser Origins accepted on `/mcp`. A value replaces the built-in
# list (chatgpt.com, *.openai.com, claude.ai, claude.com, *.anthropic.com, cursor.com, *.cursor.sh,
# vscode.dev, github.dev, *.open-design.ai), so include every default you still need.
OAUTH_DCR_ALLOWED_HTTPS_HOSTS=
# Comma-separated HTTPS hosts to block. New registrations are rejected; already registered clients with a
# blocked redirect host lose authorize, code exchange and refresh. Issued access tokens expire within an hour.
OAUTH_DCR_BLOCKED_HTTPS_HOSTS=
OAUTH_DCR_RATE_LIMIT_PER_MIN=30
# -----------------------------------------------------------------------------
# Unified OpenDesign Model Gateway & AMR Identity (defaults to local mock fixtures)
# Set MODEL_GATEWAY_MODE=opendesign and supply OPENDESIGN_INTERNAL_API_TOKEN for live AMR calls.
# -----------------------------------------------------------------------------
MODEL_GATEWAY_MODE=mock
OPENDESIGN_API_URL=https://amr-api.open-design.ai
OPENDESIGN_LINK_URL=https://amr-link.open-design.ai
# OpenDesign web console opened by account/plan links (point non-production environments at their own console).
OPENDESIGN_CONSOLE_URL=https://open-design.ai/cloud
# OPENDESIGN_INTERNAL_API_TOKEN=CHANGE_ME_AMR_CLOUD_INTERNAL_API_TOKEN
OPENDESIGN_INTERNAL_API_TOKEN=
OPENDESIGN_S2S_API_KEY=
AMR_IDENTITY_CACHE_TTL_SEC=60
OPENDESIGN_ASR_URL=
OPENDESIGN_BILLING_SYNC_ENABLED=true
ALLOW_DOH_FAKEIP_FALLBACK=false
# -----------------------------------------------------------------------------
# Worker tuning & local container resource limits
# On hosts with >= 8 GiB Docker/Colima VM RAM, raise RENDER_SHM_SIZE=1g and
# RENDER_MEM_LIMIT=4g for long or 1080p/4K exports.
# -----------------------------------------------------------------------------
MEDIA_CONCURRENCY=20
RENDER_CONCURRENCY=1
RENDER_CAPTURE_WORKERS=auto
BLOB_GC_GRACE_SECONDS=604800
HISTORY_COALESCE_WINDOW_MS=4000
# -----------------------------------------------------------------------------
# Cloud Web Observability (Sentry DSN injected into Studio HTML at runtime)
# Leave SENTRY_WEB_DSN empty to disable web Sentry reporting completely.
# -----------------------------------------------------------------------------
SENTRY_WEB_DSN=
SENTRY_ENVIRONMENT=development
SENTRY_RELEASE=
SENTRY_TRACES_SAMPLE_RATE=0.1
# -----------------------------------------------------------------------------
# Cloud Web Telemetry (PostHog + optional Tracert dual-reporting)
# PostHog stays disabled unless OPENMOTION_TRACKING_ENABLED=1 and a public phc_* token
# (OPENMOTION_POSTHOG_TOKEN or OPENMOTION_POSTHOG_KEY) are set.
# Tracert web reporting stays disabled unless OPENMOTION_TRACERT_SPM_A is set
# (OPENMOTION_TRACERT_ENDPOINT is optional; omit to use the SDK default collector).
# Self-hosted deployments with neither configured emit zero telemetry.
# Honors OPENMOTION_TELEMETRY=0 and DO_NOT_TRACK=1 opt-outs.
# -----------------------------------------------------------------------------
OPENMOTION_TRACKING_ENABLED=0
# Set to 1 to temporarily bypass the cloud browser event allowlist during diagnostics.
OPENMOTION_CLOUD_TRACKING_FULL=
OPENMOTION_POSTHOG_TOKEN=
OPENMOTION_POSTHOG_HOST=https://us.i.posthog.com
OPENMOTION_TRACKING_INSTALLATION_ID=
OPENMOTION_TRACERT_SPM_A=
OPENMOTION_TRACERT_ENDPOINT=
API_MEM_LIMIT=1g
MEDIA_MEM_LIMIT=1g
MEDIA_TMP_SIZE=1g
RENDER_MEM_LIMIT=2g
RENDER_SHM_SIZE=512m
RENDER_TMP_SIZE=2g