This document records the security boundaries enforced by the application and the minimum deployment requirements for them. It is a living checklist, not a claim that a static audit can prove the absence of every vulnerability.
- Go API mutations reject a browser
Originthat is not inCORS_ALLOWED_ORIGINS; unsafe cookie-bearing requests with noOriginare rejected as well. - Credentialed CORS never accepts
*; origins must be completehttp://orhttps://origins without a path, query, fragment, or user-info component. - Access and refresh cookies are
HttpOnly,SameSite=Strict, andSecure; production refuses to start ifAUTH_COOKIE_SECURE=false. AUTH_JWT_SECRETmust contain at least 32 characters whenever database/Firebase authentication is assembled. Access JWTs require the expected issuer, audience, HS256 algorithm, and bounded TTL.- Firebase login accepts only Google sign-in identities with verified email and a stable Google
provider subject. The one-call
/auth/sessionendpoint refuses to reuse cookies from a different Firebase user. - Backend session establishment checks Firebase revocation/disabled-user state with an eight-second
upstream deadline. Invalid/revoked identities return
401; transient upstream failures return retryable503. - Refresh-token replacement is an atomic PostgreSQL lock/revoke/insert operation. Concurrent replay cannot mint two descendants, and disabled/deleted users cannot refresh.
- Every execution request re-checks that the JWT
sidandsubstill identify the same active, unexpired PostgreSQL session. Logout, refresh rotation, and server-side revocation therefore stop account/position reads as well as new orders, commands, pairing, mappings, layout changes, disconnects, and removals immediately; a session-store outage fails execution closed. - Execution requests are throttled per authenticated user before the active-session database read. All mutations share a lower ceiling, orders/commands have a stricter ceiling, and pairing-token issuance has the strictest ceiling. Keep Cloudflare/WAF limits enabled as the distributed outer layer.
- Frontend logout is fail-closed: Firebase sign-out is not presented as successful when the backend could not revoke the HttpOnly execution session.
- Auth establishment endpoints have a per-client in-process rate limit. Keep a Cloudflare/WAF rate limit enabled as the distributed outer layer.
- Next push-device endpoints require a Firebase ID token. Device records are associated with the Firebase UID, preventing one signed-in user from managing another user's token.
PUSH_WORKER_SECRET,CRON_SECRET, andALERT_WEBHOOK_SECRETchecks fail closed when the configured secret is missing or incorrect.- Use at least 32 random bytes for worker and bridge secrets. Never place these values under a
NEXT_PUBLIC_variable. - The Python MT5 stream is loopback-only because its WebSocket protocol has no remote authentication. Do not bind it to a LAN/WAN interface without adding an authenticated protocol.
- FTMO bridge live mode and any non-loopback bind require
FTMO_BRIDGE_TOKEN(32+ random bytes).
- Go request bodies are capped at 8 MiB and responses include browser hardening headers.
- Push tokens, alert counts, notification text, and push data are bounded before persistence or delivery.
- Discord webhook URLs are restricted to official HTTPS webhook hosts both when written and when read from legacy storage.
- Frontend runtime dependencies are locked and must pass
npm audit --omit=dev --audit-level=lowwith zero findings. This gate is currently failing with one high advisory and must be restored:nanoid@3.3.16(GHSA-2v37-7h3g-55p8) reaches the production tree through the repository's ownpostcss@8.5.23override. The dependency and its version are byte-identical to commitf94e346, so the 2026-08-18 Next/Tailwind/TypeScript upgrade did not introduce it; the advisory was published after this section was last written. Fixing it means moving the pinned PostCSS override forward, which needs its own clean production audit and build. Run the fullnpm auditas an informational second gate. As of 2026-08-18 it reports three high advisories -brace-expansion,js-yaml,nanoid- unchanged in count and identity by that upgrade. The first two are confined to the ESLint development dependency chain: forcing ESLint 10 breaks the React plugin bundled byeslint-config-next@16.3.1, and forcing onebrace-expansionmajor breaks Minimatch. These packages are not included in the production bundle; remove this temporary exception as soon as the Next ESLint stack supports the fixed major. - Next, Firebase, PostCSS, Sharp,
fast-xml-parser, andprotobufjsare pinned/resolved to patched versions infrontend/package-lock.json. Do not remove the PostCSS/Sharp overrides without a clean production audit and build. - Backend builds must use Go 1.26.5 or newer. The
go 1.26.5directive inbackend/go.modmakes that minimum explicit because Go 1.26.4 contains acrypto/tlsvulnerability detected bygovulncheck. - Run
govulncheck ./...for every backend dependency change. The release gate is zero reachable symbol/package vulnerabilities. A module-only warning is acceptable only whengo mod why <vulnerable-package>proves the main module does not need that package; record it in the release notes rather than silently suppressing it.
Provider variables prefixed with NEXT_PUBLIC_ are bundled into browser JavaScript. This currently
includes optional market-data provider keys. Treat those keys as exposed and restrict/rotate them
at the provider; if the provider key is confidential, move the provider call behind a server-side
proxy before production use.
cd frontend
npm ci
npm audit --omit=dev --audit-level=low
npm audit
npm run typecheck
npm run lint
npm run build
cd ../backend
go test ./...
go vet ./...
govulncheck ./...Set production secrets, verify CORS_ALLOWED_ORIGINS contains only the deployed frontend origin,
confirm the runtime reports Go 1.26.5 or newer, and retain the scan output with the release evidence
before exposing the service publicly.
The confirmation dialog remains a safety affordance. Users may enable an optional second trade
password, requested once per browser trade session and shared across its tabs through a
non-persistent, HttpOnly, server-backed unlock cookie. Go always issues a short-lived one-time
token bound to the exact JSON payload, user, and active session; Rust atomically consumes it before
enqueueing and fails closed on reuse, mutation, expiry, revocation, or unavailable database state.
The frontend also enforces a per-request nonce CSP with production strict-dynamic, no script
attributes, no unsafe-eval, no framing, and no object embedding. This substantially reduces XSS
reach but does not make arbitrary same-origin compromise impossible.