Sample alert How it works Coverage PENTEST METHODOLOGY DOCS PRICING FAQ MCP CONTACT LOG IN SCAN MY APP →

Is Railway Safe? Public DB Proxy, Templates & Secrets

Railway simplifies deploys. You still own secrets, public service exposure, and application auth - where vibe-coded apps most often fail.

SCAN YOUR RAILWAY APP NOW

Paste your Railway public URL - we check for exposed secrets, open admin paths, and broken auth on the live service.

Container Isolation

Railway runs each service in an isolated container with private networking between services in the same project. Public services get a *.up.railway.app domain automatically; private services are reachable only on the project’s internal network. The platform handles TLS termination, container orchestration, and managed Postgres/Redis/Mongo with encryption at rest.

Platform-side security is solid. Problems on Railway projects come from three places: services accidentally made public, env vars copied across environments without scoping, and templates that ship with the author’s defaults, which can include weak credentials and broad permissions.

Railway is safe infrastructure for typical web apps, but it does not replace application authorization. Public networking, the public DB proxy, and one-click templates are the defaults where vibe-coded projects get hurt.

Security Considerations

Database Access

Railway databases (Postgres, MySQL, Redis, MongoDB) come with both an internal connection string (postgres.railway.internal) and a public proxy URL (xxx.proxy.rlwy.net). Use the internal one for service-to-service traffic. The public proxy is intended for local development and ad-hoc tools - leaving it enabled in production makes your database reachable from the internet, protected only by its credentials.

# In your service env vars
DATABASE_URL=${{Postgres.DATABASE_URL}}             # internal, preferred
DATABASE_PUBLIC_URL=${{Postgres.DATABASE_PUBLIC_URL}}  # public proxy, avoid

If you must keep the public proxy on (for analytics tools, BI, migrations from a CI runner), rotate the database password regularly and treat the credentials as exposed. Railway does not yet offer IP allowlisting on the proxy.

For CI migrations:

  • Ephemeral CI job uses the public URL with a strong password
  • Job runs only on protected branches
  • Password rotated after the job if it was shared broadly
  • App runtime still uses internal URL only

Never put DATABASE_PUBLIC_URL into a frontend service “so Prisma Studio works.” Studio can run from a laptop with a tunnel or a one-off shell service.

Service Exposure

Every service has a “Networking” tab. The default for most templates is to enable public networking and generate a *.up.railway.app domain. For internal services (workers, queues, cron jobs, internal APIs) you should toggle that off:

  • Settings → Networking → Public Networking → Off
  • Use the internal hostname (<service>.railway.internal) from sibling services

If a service does need to be public, attach your own domain and add an authentication layer in front. Railway does not provide a built-in WAF or auth shim. Your app middleware is the gate.

Inventory exercise (do this before launch):

Service Needs public HTTP? Public networking Notes
web Yes On Auth in app
worker No Off Internal only
redis No Off Never public
postgres No Proxy off if possible Internal URL in apps
cron No Off Triggered internally

Environment Variables

Variables are scoped per environment (production, staging, PR previews). Reference shared values across services using the ${{Service.VAR}} syntax instead of duplicating, which makes rotation a single edit:

# In API service
DATABASE_URL=${{Postgres.DATABASE_URL}}
JWT_SECRET=${{shared.JWT_SECRET}}

# In Worker service
DATABASE_URL=${{Postgres.DATABASE_URL}}
JWT_SECRET=${{shared.JWT_SECRET}}

Common mistake: PR Environments inherit production variables unless you explicitly scope. A leaked PR preview URL with production database access is a common audit finding.

Least privilege: the worker that only processes email jobs does not need Stripe live keys. Split variables so a compromised worker cannot empty your payment account.

Application Security

Railway secures the platform; authentication, authorization, input validation, and the rest of the application security stack are yours. The container runtime is shared-kernel, so don’t rely on container isolation for security boundaries between trust zones - keep tenants in separate projects, or in separate database schemas with row-level security.

AI-generated Express/Next/FastAPI handlers deploy here with the same gaps as anywhere else: missing ownership checks, open CORS, secrets in logs. Scan the public URL with VibeEval after every meaningful deploy.

Templates and One-Click Deploys

Many templates ship with:

  • Default admin credentials (admin/admin, postgres/postgres)
  • Debug endpoints exposed publicly
  • Public networking on every service including internal queues
  • NODE_ENV=development so the framework runs in debug mode
  • Sample API keys left in variable placeholders

Always audit a freshly-deployed template before pointing real traffic at it. Change credentials, disable debug endpoints, toggle off public networking on internal services, and confirm NODE_ENV=production.

Template audit steps:

  1. List services and networking toggles
  2. Rotate every default password
  3. Grep the generated code for TODO, debug, admin/admin
  4. Confirm production env has no sample secrets
  5. Run a live scan on the web service domain

Common Mistakes

  • Database public proxy left on in production with no rotation since the project was created.
  • Internal worker services exposed via public networking because the template enabled it.
  • PR Preview environments inheriting production env vars, including third-party API keys.
  • ${{Postgres.DATABASE_URL}} referenced in a frontend service that shouldn’t have direct DB access.
  • Templates deployed without changing default admin credentials.
  • Cron services running with the same env vars as the API, including secrets they don’t need.
  • Logs (visible in the Railway UI) printing request bodies that contain PII or auth tokens.
  • Redis/Memcached with public networking “to debug from laptop.”
  • One-off migration services left deployed with admin credentials and a public domain.
  • Resource limits unset, so a loop in AI-generated code can run up the bill.

Comparison vs Render and Fly.io

  • Render has safer defaults. Private services are private, and the free tier sleeps. It suits teams that want minimal config. See Is Render Safe?.
  • Railway is flexible and template-driven. The template path can land teams on insecure defaults.
  • Fly.io gives you raw infrastructure primitives and Firecracker isolation. Easy to misconfigure if you skip the docs. See Railway vs Fly.io.

For multi-tenant SaaS or regulated workloads, Fly’s VM isolation is the stronger boundary. For typical web apps, Railway and Render are comparable if you fix networking and env scope.

Enterprise Considerations

  • SSO: SAML SSO on the Pro plan and above; below that, accounts are personal GitHub/Google identities.
  • Audit Logs: Project audit log is available; team-wide events visible in the workspace settings. Pull via API to your SIEM.
  • Compliance: SOC 2 Type II. HIPAA is not currently advertised - confirm with their team if you need a BAA.
  • Backups: Managed databases have daily backups on paid plans. Test restore quarterly.
  • Secret rotation: No built-in scheduled rotation. Use an external manager (Doppler, Infisical) and push to Railway via the GraphQL API.
  • RBAC: Limit who can deploy production and who can read variables; deploy rights are secret-read rights.

Security Assessment

Strengths

    • Isolated container-based deployments
    • Automatic HTTPS for all public services
    • Encrypted environment variables with cross-service references
    • Private networking between services in the same project
    • SOC 2 Type II compliance
    • Built-in database encryption at rest
    • PR preview environments for safe iteration

Concerns

    • Application security is developer responsibility
    • Database public proxy is on by default and lacks IP allowlisting
    • Public networking is the default for new services
    • Templates frequently ship with insecure defaults
    • PR Previews inherit production env vars unless explicitly scoped
    • Resource limits must be set appropriately to avoid runaway costs
    • Container isolation is shared-kernel, not VM-level

Hardening checklist (Railway-specific)

  1. Public networking off for workers, queues, cron, Redis, and internal APIs.
  2. DB: app services use internal DATABASE_URL; disable or tightly control public proxy; rotate password if proxy was ever public with a weak password.
  3. Env scopes: production secrets not available to PR/preview; use ${{Service.VAR}} references.
  4. Templates: change default admins, set NODE_ENV=production, remove debug routes.
  5. Least privilege: workers get only the secrets they need, not the full API env dump.
  6. Logs: scrub auth headers and bodies; do not console.log(process.env).
  7. Resource limits: CPU/memory caps so a bug cannot infinite-scale your bill.
  8. App auth: every public HTTP route authenticates and authorizes (platform will not do this).
  9. Backups: verify managed DB backups and test restore.
  10. Scan the public *.up.railway.app or custom domain with VibeEval.
  11. Headers on the web service (Security Headers Checker).
  12. Team access: remove ex-members; rotate shared tokens.

For step-by-step UI paths, see How to Secure Railway.

How AI-generated apps fail on Railway

Cursor, Claude, and Bolt deploys often:

  • Expose the API and a “worker” both publicly because the template did.
  • Put the Postgres public URL in the frontend service “for Prisma Studio convenience.”
  • Copy production OpenAI keys into the PR environment so previews “work.”
  • Leave /metrics or /debug open on the public domain.
  • Run migrations from a one-off service that stays deployed with admin credentials.
  • Commit .env samples that still contain real template secrets.
  • Skip rate limits on LLM routes, which risks a large bill on a public *.up.railway.app.

These are configuration and application mistakes, not Railway breaches.

Example: private worker, public web

# Web service uses internal DB
DATABASE_URL=${{Postgres.DATABASE_URL}}

# Worker - no public domain, same internal DB
DATABASE_URL=${{Postgres.DATABASE_URL}}
# Only queue-related secrets, not Stripe live keys

In the dashboard: Worker → Networking → Public Networking → Off.

How to verify

# From a machine outside Railway - public proxy should fail or be disabled
psql "$DATABASE_PUBLIC_URL" -c 'select 1'   # expect fail if hardened

# Confirm internal-only services have no public domain in the dashboard
# Networking → Public Networking → Off

From the browser: open the Railway default domain for each service; workers should not serve an HTTP app. Grep the web service bundle for secrets. Two-user BOLA test on the app.

curl -sI https://your-app.up.railway.app | head
# HSTS / security headers if configured at app layer

# Unauthenticated admin should fail
curl -s -o /dev/null -w '%{http_code}\n' https://your-app.up.railway.app/admin

Use Token Leak Checker on the web domain for client-side key leaks.

Observability and incident basics

Railway logs are not a SIEM. For production SaaS:

  • Forward app logs (not raw secrets) to a durable sink
  • Alert on 5xx spikes and auth failure bursts
  • Keep an inventory of public domains for the project so forgotten services do not stay exposed
  • After a leaked preview URL, rotate any production secrets that preview could access

Who should pick Railway (security framing)

Good fit: AI-built full-stack apps that want fast multi-service deploys and will spend time on networking and env hygiene.

Needs extra care: multi-tenant products (app-layer isolation required), anything with a public DB proxy requirement (treat password as semi-public).

Wrong expectation: a template deploy is not production-ready security. Templates are built for demos.

The Verdict

Railway is a safe deployment platform. Container isolation and private networking give typical workloads solid service boundaries. Before launch, audit the database public proxy, internal services accidentally made public, and template defaults, then secure the application layer.

How to Secure Railway

Step-by-step guide covering networking toggles, env var scoping with ${{Service.VAR}} references, database proxy hardening, and the template-audit checklist.

Railway Security Checklist

Interactive checklist for launch-blockers and the quarterly review.

Is Render Safe?

Side-by-side analysis of the two most popular platforms in the same DX bracket.

Railway vs Fly.io

Isolation and default-exposure comparison.

How to Secure Fly.io

If you need micro-VM boundaries instead of shared-kernel containers.

Vibe Code Scanner

Live probing for AI-shaped app failures on your Railway domain.

Scan Your Railway App

VibeEval scans your Railway deployment for exposed database proxies, public internal services, and missing auth.

Common questions

Is Railway safe for production?
Yes for typical web apps when you turn off unnecessary public networking, use internal DB URLs, scope env vars per environment, and secure the application itself. Railway provides container isolation, TLS, and SOC 2 Type II - it does not write your auth checks.
Should I use DATABASE_PUBLIC_URL in production?
No. Prefer the internal DATABASE_URL for service-to-service traffic. The public proxy is for local tools and CI; leaving it on exposes Postgres to the internet gated only by password.
Are Railway templates secure?
Often not by default. Templates may ship debug modes, public networking on workers, and default credentials. Audit every template deploy before real traffic.
Do PR environments share production secrets?
They can if you do not scope variables. Configure preview/PR environments with non-production credentials so a leaked preview URL cannot touch production data.
Is Railway suitable for multi-tenant SaaS?
Yes with application-layer isolation (RLS or separate schemas/projects). Container isolation is shared-kernel - do not treat containers as hard multi-tenant security boundaries for hostile tenants.
How does Railway compare to Fly.io and Render?
Railway optimizes DX and templates; Render optimizes safe defaults; Fly.io optimizes micro-VM isolation. Pick based on isolation needs and your willingness to audit template defaults.

Secure beyond railway defaults

Hosting hygiene is step one. Scan the running app for the AI-generated gaps platform defaults never catch.

14-day free trial · Cancel anytime

SCAN MY RAILWAY APP →