Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update email validation with Truemail #398

Merged
merged 16 commits into from
Jun 12, 2024

Conversation

delano
Copy link
Collaborator

@delano delano commented Jun 12, 2024

This pull request updates the email validation in the codebase to use the Truemail gem. Truemail provides comprehensive email validation based on RFC 5322 and RFC 5321. It performs checks on the domain, MX records, and SMTP server to ensure that the email address is valid. By using Truemail, we can improve the robustness of our email validation and avoid sending emails to invalid addresses.

Fixes #392

delano and others added 16 commits June 11, 2024 16:00
Rationale: truemail is a gem that goes above and beyond when it comes to
validating email addresses. It checks the domain, the MX records, and
the SMTP server to ensure that the email address is valid. We will use
it to ensure that the email addresses being used by the application are
valid. This will help us to avoid sending emails to invalid email
addresses and improve our mail deliverability.
Changed start methods to clarify boot process:

- Renamed Onetime.load! to Onetime.boot! to better reflect its purpose
of initializing the application
- Updated references to the boot method throughout the codebase
- Added documentation to Onetime module and boot method describing the
boot process

This simplifies initialization and improves grokability by using more
precise terminology. The name "load" was somewhat ambiguous, while
"boot" more clearly conveys that the application is being started up and
prepared to serve requests. "Boot" also implies there's an order of
operations which is important to understand when working with the
application.

Notes:

- No functional changes, just naming for clarity
- More boot process documentation to be added
The `OT::Config.after_load` method was added to run additional
initialization tasks after loading the configuration. It extracts the
`:from` email address from the config and configures TrueMail
accordingly.

Set TrueMail verifier email address after loading onetime configuration.
This ensures the verifier email is set properly based on the config,
avoiding errors during email validation.
Includes tests for existing email validation logic.
Current we're validating just the format of the email address. Let we'll
leverage the Truemail gem to validate whether the email address is
actually deliverable, not on a deny list, and not a temporary email
address.
This is a partial revert for commit 4b9ae8c (PR #393)
The or-equals conditional assignment for `@email_address` could
potentially carry over a value from a previous test.

See:
https://github.com/onetimesecret/onetimesecret/actions/runs/9485588070/job/26137975444?pr=395
…nSave

Partial revert for Ruby 3 syntax changes
@delano delano self-assigned this Jun 12, 2024
Copy link
Collaborator Author

@delano delano left a comment

Choose a reason for hiding this comment

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

👍

@delano delano merged commit 1f1d5b4 into feature/typed Jun 12, 2024
4 checks passed
@delano delano deleted the 392-update-enail-validation-reprise branch June 12, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

1 participant