Skip to content

fix: remove hardcoded JWT secret defaults, enforce min length (#892) - #995

Merged
nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
abdoolyaro:fix/892-jwt-secret-validation
Jul 27, 2026
Merged

fix: remove hardcoded JWT secret defaults, enforce min length (#892)#995
nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
abdoolyaro:fix/892-jwt-secret-validation

Conversation

@abdoolyaro

Copy link
Copy Markdown
Contributor
  • Remove weak fallback defaults from AuthService constructor
  • Throw on startup if JWT_SECRET/JWT_REFRESH_SECRET missing or under 32 chars (256 bits)
  • Add length validation to validate-env.ts alongside existing presence check
  • Update .env.example placeholders to meet the new minimum and document it
  • Bump mocked JWT secrets in auth.service.captcha.spec.ts to 32+ chars (was breaking under the new validation)

Closes #892

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@abdoolyaro 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

…hain#892)

- Remove weak fallback defaults from AuthService constructor
- Throw on startup if JWT_SECRET/JWT_REFRESH_SECRET missing or under 32 chars (256 bits)
- Add length validation to validate-env.ts alongside existing presence check
- Update .env.example placeholders to meet the new minimum and document it
- Bump mocked JWT secrets in auth.service.captcha.spec.ts, auth-refresh-token-reuse.spec.ts, password-reset-token-validation.spec.ts, rate-limit-burst.e2e.spec.ts, and fraud-auto-block.e2e.spec.ts to 32+ chars (all were breaking under the new validation)

Closes MettaChain#892
@abdoolyaro
abdoolyaro force-pushed the fix/892-jwt-secret-validation branch from 197bb4d to a72b505 Compare July 27, 2026 00:51

@nanaf6203-bit nanaf6203-bit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nanaf6203-bit
nanaf6203-bit merged commit 95e6679 into MettaChain:main Jul 27, 2026
5 checks passed
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.

Fix security: hardcoded JWT secrets with weak defaults in AuthService

2 participants