Skip to content

security: enforce JWT secret minimum entropy #509

Description

@dotunv

Problem

config/env.js validates that JWT_SECRET is set but does not enforce minimum length or entropy. A weak or short secret could allow token forgery.

Current Validation

if (!process.env.JWT_SECRET) {
  missing.push('JWT_SECRET');
}

Solution

Add minimum requirements:

if (!process.env.JWT_SECRET) {
  missing.push('JWT_SECRET');
} else if (process.env.JWT_SECRET.length < 32) {
  warnings.push('JWT_SECRET should be at least 32 characters');
}

Also

  • Validate STELLAR_NETWORK is one of testnet or mainnet
  • Validate PLATFORM_SECRET_KEY starts with S and is the correct length
  • Validate PORT is a number if set

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions