Skip to content

fix(security): remove fallback JWT secrets - #398

Open
Blaqkenny wants to merge 1 commit into
UnityChainxx:mainfrom
Blaqkenny:fix/blaqkenny-remove-fallback-jwt-secrets
Open

fix(security): remove fallback JWT secrets#398
Blaqkenny wants to merge 1 commit into
UnityChainxx:mainfrom
Blaqkenny:fix/blaqkenny-remove-fallback-jwt-secrets

Conversation

@Blaqkenny

Copy link
Copy Markdown
Contributor

Resolves the Stellar Wave issue assigned to Blaqkenny.

Changes

  • backend/src/admin/admin.module.ts — replaced JwtModule.register({ secret: process.env.JWT_SECRET || 'supersecret' }) with JwtModule.registerAsync resolving JWT_SECRET via ConfigService.getOrThrow.
  • backend/src/admin/strategies/jwt.strategy.ts — replaced process.env.JWT_SECRET || 'supersecret' with ConfigService.getOrThrow('JWT_SECRET').
  • backend/src/auth/strategies/jwt.strategy.ts — replaced configService.get('JWT_SECRET') || 'your-secret-key' with ConfigService.getOrThrow('JWT_SECRET').

No hard-coded/predictable secrets remain: startup now fails fast when JWT_SECRET is absent (global Joi validation already requires it, and every consumer now resolves it without a fallback).

Tests

  • New jwt.strategy.spec.ts for both admin and user strategies proving the strategy cannot be constructed when JWT_SECRET is missing/empty, and that the resolved secret is exactly the configured value (never a predictable default).
  • Existing config-validation.spec.ts already proves the app config rejects a missing JWT_SECRET.

Closes #250

Replace the hard-coded `|| 'supersecret'` / `|| 'your-secret-key'`
fallbacks in the admin module, admin JWT strategy and user JWT strategy
with required configuration resolution (`ConfigService.getOrThrow`), so
startup fails when JWT_SECRET is absent instead of silently using a
predictable secret. Adds tests proving the strategies cannot be
constructed without a configured secret and never fall back to a
predictable default.

Closes UnityChainxx#250

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@Blaqkenny Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P0][security] Remove fallback JWT secrets

1 participant