Log email sending and check for PII when sending asynchronous email#7155
Merged
mitchellhenke merged 6 commits intomainfrom Oct 19, 2022
Merged
Log email sending and check for PII when sending asynchronous email#7155mitchellhenke merged 6 commits intomainfrom
mitchellhenke merged 6 commits intomainfrom
Conversation
8280a26 to
1f57afd
Compare
1f57afd to
a5aec9a
Compare
Comment on lines
8
to
10
Contributor
There was a problem hiding this comment.
🤔 what if we only applied the lint to UserMailer and its subclasses instead of ApplicationMailer?
Contributor
Author
There was a problem hiding this comment.
I think that'd make sense, I don't know how to do that off-hand from a brief look at the current linter.
Contributor
There was a problem hiding this comment.
ok! I'll poke around at it for a follow-up
zachmargolis
approved these changes
Oct 19, 2022
Contributor
There was a problem hiding this comment.
I just remembered we can use prepend to avoid alias_method dances in #7165
So here we could define somewhere the file:
module DeliverLaterArgumentChecker
def deliver_later(...)
MailerSensitiveInformationChecker.check_for_sensitive_pii!(@params, @args, @action)
super(...)
end
endand turn this into:
Suggested change
| alias_method :original_deliver_later, :deliver_later | |
| prepend DeliverLaterArgumentChecker |
Contributor
Author
There was a problem hiding this comment.
Thanks for reminding me, added in b8f658b
added 5 commits
October 19, 2022 10:08
changelog: Internal, Logging, Log Emails Sent
a5aec9a to
fa51717
Compare
This was referenced Oct 20, 2022
Closed
Merged
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.
🛠 Summary of changes
Builds on #7106 to check for PII when sending async emails since they get saved in the database!
I don't love the approach of
instance_variable_getandinstance_variable_set, and would very much have preferred to use the instrumented deliver method fromActionMailer, but it doesn't include the arguments given to the Mailer (likeuser, which we want to log, or theactionthe mail was derived from).The only other hook that exists after the mail is delivered is the email observer
delivered_email. A list of all the hooks in the order that they happen: