Skip to content

feat: implement #736, #737, #738, #739 - reactivation rate-limit, audit log, redactEmail helper#850

Merged
nanaf6203-bit merged 2 commits into
MettaChain:mainfrom
Tyler7x:feat/tyler7x-issues
Jun 29, 2026
Merged

feat: implement #736, #737, #738, #739 - reactivation rate-limit, audit log, redactEmail helper#850
nanaf6203-bit merged 2 commits into
MettaChain:mainfrom
Tyler7x:feat/tyler7x-issues

Conversation

@Tyler7x

@Tyler7x Tyler7x commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Closes #736, Closes #737, Closes #738, Closes #739

#736 - Use constant-time comparison for reactivation token verification

Already implemented in #735 - uses crypto.timingSafeEqual to compare the hashed token from the database against a SHA-256 hash of the provided token.

#737 - Rate-limit /users/me/reactivate to 5 requests per hour per email

Added in-memory rate limiter in UsersController that tracks reactivation attempts by email. Returns 429 Too Many Requests after 5 attempts within a 1-hour window.

#738 - Add audit log entry for account reactivation attempts

Added prisma.activityLog.create call in UsersService.reactivate() with action "REACTIVATE" and entity type "USER".

#739 - Introduce redactEmail helper and use in all log lines

Created exported redactEmail(email: string): string in security.utils.ts that returns createSha256(email).slice(0, 8). Updated log lines in auth.service.ts, users.service.ts, and login-rate-limit.service.ts to use redactEmail instead of raw email addresses.

Tyler7x and others added 2 commits June 29, 2026 14:30
…Chain#739

MettaChain#736 - Use constant-time comparison (already implemented)
MettaChain#737 - Rate-limit /users/me/reactivate to 5 requests/hour/email
MettaChain#738 - Add audit log entry for account reactivation
MettaChain#739 - Create reusable redactEmail helper
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

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

@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 8bdd349 into MettaChain:main Jun 29, 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

2 participants