Security: Fix critical security vulnerabilities - #199
Merged
parkerwinner merged 1 commit intoJul 30, 2026
Conversation
- Remove hardcoded JWT secret defaults and require environment variables (parkerwinner#185) - Add password reset flow with email token verification (parkerwinner#186) - Implement account lockout after 5 failed login attempts in 15 minutes (parkerwinner#187) - Fix SQL injection vulnerabilities in search using parameterized queries (parkerwinner#188) Security improvements: - JWT secrets must be at least 32 characters and set via env vars - Account locks for 30 minutes after 5 failed logins within 15 minutes - Password reset tokens expire in 1 hour - All database queries use parameterized/prepared statements - Failed login attempts are tracked per user - Account lockout is automatically cleared on successful password reset Database migrations: - Added reset_token and reset_token_expires_at to users table - Added failed_login_attempts, locked_until, and last_failed_login_at to users table
|
@Georgechisom 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! 🚀 |
Owner
|
Good job @Georgechisom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security: Fix Critical Security Vulnerabilities
Summary
This PR addresses four critical security vulnerabilities in the authentication and search systems. All changes follow security best practices and include proper validation, parameterized queries, and rate limiting.
Changes
1. Remove Hardcoded JWT Secrets
JWT_SECRETandJWT_REFRESH_SECRET.env.examplewith clear security documentation2. Password Reset Flow
/auth/forgot-passwordand/auth/reset-passwordcrypto/randreset_token,reset_token_expires_at3. Account Lockout After Failed Logins
failed_login_attempts,locked_until,last_failed_login_at4. Fix SQL Injection in Search
plainto_tsqueryDatabase Migrations
Migration 000006: Password reset functionality
reset_token(VARCHAR 255, indexed)reset_token_expires_at(TIMESTAMPTZ)Migration 000007: Account lockout functionality
failed_login_attempts(INT, default 0)locked_until(TIMESTAMPTZ, indexed)last_failed_login_at(TIMESTAMPTZ)Security Improvements
Testing Notes
Manual testing required for:
Configuration Required
Add to production environment:
Generate secure secrets using:
Closes #185
Closes #186
Closes #187
Closes #188