Skip to content

πŸ”„ [MEDIUM] Server Starts Without Validating Critical Environment VariablesΒ #1001

Description

@ayomideadeniran

Description

The backend server starts without checking if critical environment variables are set, silently defaulting to localhost values that may not work in production.

Impact

Missing validation for:

  • DATABASE_URL β€” defaults to local SQLite file
  • REDIS_URL β€” defaults to redis://localhost:6379
  • SOROBAN_RPC_URL β€” defaults to Soroban testnet
  • SSL_KEY_PATH / SSL_CERT_PATH β€” HTTPS silently falls back to HTTP without warning
  • NODE_ENV β€” defaults to development, may accidentally run dev config in production

Example

In redisService.js:

const REDIS_URL = process.env.REDIS_URL || redis://localhost:6379;

If Redis is not running locally, the service silently falls back to in-memory mode.

Required Fix

  1. Add a startup validation function that checks required env vars
  2. Log clear warnings for missing optional vars with their fallback values
  3. Fail fast if production-required vars are missing
  4. Consider using a package like envalid for structured validation

Reference

Identified during full codebase audit of soroban-playground.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related issuesenhancementNew feature or requestsecuritySecurity related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions