Log details of mailing error and don't display details to end user #21173
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.
Overview
Found when using the sparkpost extension and an error from sparkpost causes a failure to send the email. The CiviCRM mail library logs the message to the user session and it is then displayed - this is problematic because there could be sensitive information returned in the error message. Additionally there is no indication that an error occurred in the CiviCRM log files.
Before
Error message from mailer is displayed to end-user who is trying to unsubscribe:
After
Simple error message displayed to end-user with no sensitive information. Detail recorded as error in CiviCRM log:
Technical Details
CRM_Core_Session::setStatus()
will display the message to any user who has an active session (eg. when following an unsubscribe link in an email). When certain mailing libraries are using this results in far too much detailed information being displayed to the end-user and not recorded in the logs.Comments
@mlutfy @seamuslee001