This document outlines the security policies, environment variable placement rules, and secret rotation procedures for DataForge AI.
To prevent accidental credential leaks:
- Private Env Vars (Backend API / Railway only): Must never be added to Vercel. These variables are handled securely on the server side.
- Public Env Vars (Vercel only): Frontend variables must be prefixed with
NEXT_PUBLIC_to be bundled in the Next.js static build. Do not expose backend credentials here.
| Variable | Target Platform | Scope / Reason |
|---|---|---|
DATABASE_URL |
Railway | Private connection URL (Supabase pooled port 6543) |
DIRECT_URL |
Railway | Private connection URL (Supabase direct port 5432 for migrations) |
REDIS_URL |
Railway | Private connection string (Upstash TLS rediss://) |
JWT_SECRET |
Railway | Private token signature key |
SHELBY_PRIVATE_KEY |
Railway | Private key for live Shelby uploads |
SENTRY_DSN |
Railway | Sentry DSN for backend exception logging |
NEXT_PUBLIC_API_URL |
Vercel & Railway | Public API endpoint of the backend |
NEXT_PUBLIC_SENTRY_DSN |
Vercel | Public Sentry DSN for client exception logging |
All production credentials must be rotated immediately if exposed.
JWT_SECRET signs user session tokens.
- Run the silent rotation script:
node scratch/silent_rotate.js
- Railway will automatically redeploy the backend container with the new key.
Supabase database passwords can only be changed via the Supabase web dashboard.
- Go to the Supabase Dashboard.
- Click on your project DataForge.
- In the left navigation bar, go to Settings (gear icon) -> Database.
- Scroll down to Database password and click Reset database password.
- Copy the newly generated password.
- derived connections: Update the
DATABASE_URL(port 6543 pooled connection) andDIRECT_URL(port 5432 direct connection) on your Railway variables settings. - Run migrations to verify:
npm run db:migrate:deploy
Upstash Redis credentials are changed via the Upstash dashboard.
- Go to the Upstash Console.
- Click on your Redis database.
- In the database details screen, scroll to Credentials and click Reset Password.
- Copy the new TLS connection string (
rediss://...). - Update
REDIS_URLin the Railway environment variables.
If CLI session tokens are compromised:
- Railway: Navigate to Account Settings -> Tokens on the Railway dashboard, revoke the active CLI token, and run
railway logoutfollowed byrailway login. - Vercel: Navigate to Vercel Dashboard -> Account Settings -> Tokens, revoke the active token, and run
vercel loginto authorize a new session.