Skip to content

Conversation

@devZenta
Copy link
Owner

This pull request improves the security and flow of the SMTP server's token-based email sending process. The main updates are focused on generating secure tokens, storing them properly, and enforcing validation before allowing email sending.

Token management and validation improvements:

  • Securely generates a random token using randomBytes, stores it in tokenStore with the sender's address and a validated: false flag, and constructs a validation link for the user (src/services/smtpServer.ts).
  • Adds strict checks to ensure that only validated tokens can be used to send emails: rejects requests with missing or unvalidated tokens, logs warnings, and returns SMTP error code 553 for these cases (src/services/smtpServer.ts).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements a token-based authentication system for the SMTP server to control email sending. The implementation generates secure random tokens when users "knock" (request permission), stores them with sender information, and enforces validation checks before allowing emails to be sent.

Key Changes:

  • Implements secure token generation using 32-byte random tokens converted to hexadecimal format
  • Adds validation checks to reject emails with missing, invalid, or unvalidated tokens
  • Returns proper SMTP error code 553 with descriptive messages for validation failures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nfroidure nfroidure merged commit 0819fef into main Nov 25, 2025
2 checks passed
@nfroidure nfroidure deleted the feature/token-check branch November 25, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants