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
Problem
config/env.jsvalidates thatJWT_SECRETis set but does not enforce minimum length or entropy. A weak or short secret could allow token forgery.Current Validation
Solution
Add minimum requirements:
Also
STELLAR_NETWORKis one oftestnetormainnetPLATFORM_SECRET_KEYstarts withSand is the correct lengthPORTis a number if set