What SaaS Forge does for you, and what is left to you.
Built in
Configuration
- Production refuses to start with missing core variables, short or placeholder secrets, an enabled integration without credentials, or a secret-looking
NEXT_PUBLIC_variable (apps/web/lib/env.ts). pnpm doctornever prints secret values and writes env files with0600permissions.- Downloads never send your secrets to the SaaS Forge server; the browser adds them to the archive locally.
Authentication
- Better Auth stores sessions in Postgres; cookies are HTTP-only,
Secureand__Secure--prefixed in production. - Email verification is required for password accounts; sign-in attempts are rate limited.
- The first user becomes admin; afterwards only admins change roles.
- The read-only guest role is enforced on the server for tRPC mutations, session routes and Better Auth account endpoints.
Authorization
- Every API route is declared in
apps/web/lib/route-policy.tswith its auth mode, roles, guest access, rate limit and body-size limit. A test fails if a route is missing or skips its guard. - Unlisted pages require a session; admin data is served only by admin procedures.
- With Organizations, membership is re-checked on every workspace-scoped call.
Input and requests
- tRPC and REST inputs are validated with Zod.
- The middleware rejects bodies over each route's limit with
413before the handler runs. - CORS allows only your own origin, the local dev origins and the desktop app's
app://origin. - Uploaded images are decoded and re-encoded with
sharp; only real PNG, JPEG and WebP pass, and metadata is stripped.
Payments and integrations
- Webhooks verify the provider's signature and are idempotent (unique checkout ID, transaction re-check,
P2002fallback). - API keys are random, shown once and stored as SHA-256 hashes, with scopes, expiry, revocation and per-key rate limits.
- Requests to the Python AI service are HMAC-signed with a timestamp; the service is not exposed publicly.
Logging
- Logger metadata with secret-looking keys is redacted before reaching any transport.
Your responsibility
-
Security headers. None are configured beyond CORS. Add them in
apps/web/next.config.mjs:async headers() { return [ { source: "/:path*", headers: [ { key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains; preload" }, { key: "X-Content-Type-Options", value: "nosniff" }, { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" }, { key: "X-Frame-Options", value: "DENY" }, ], }, // keep the existing /_next/:path* CORS entry for the desktop dev server ]; },Add a Content-Security-Policy once you know which third parties (analytics, payments, fonts) your pages load.
-
Ownership checks. Roles say who may call a procedure, not which rows they may touch. Always filter by
ctx.session.user.idorctx.org.id. -
New routes. Add the route-policy row, call
guardRouteorauthenticateApiKey, validate input. -
Secrets. Rotate them if they leak, use different values per environment, and keep them out of client-prefixed variables and Docker images.
-
Dependencies. Run
pnpm auditand merge updates regularly; upgrade to new SaaS Forge releases for fixes, especially those marked Security. -
Data. Enable backups, restrict database network access, and use TLS (
sslmode=require). -
Monitoring. Alert on repeated
401/403/429responses and failed webhooks.
Reporting a vulnerability in SaaS Forge
Email the security contact in docs/SECURITY.md with the details. Do not open a public issue. Fixes are released with a Security label, which puts a banner on affected projects in the Upgrade Center.
