[PM-37648] Fix double HTML encoding in emergency access emails - #7652
Conversation
|
|
|
Thank you for your contribution! We've added this to our internal tracking system for review. Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process. |
|
It doesn't look like these are actually changed. |
|
Current head now changes the three emergency-access mail paths the review called out (SendEmergencyAccessConfirmedEmailAsync, SendEmergencyAccessRecoveryApproved, and SendEmergencyAccessRecoveryReminder) and adds a regression test that checks the rendered HTML encodes the user-facing name exactly once. |
The SanitizeForEmail method HTML-encodes by default, but Handlebars templates also escape values. This caused names with special characters like umlauts to display as HTML entities (e.g. Windm&bitwarden#252;ller). Pass htmlEncode=false to match the pattern used elsewhere in this file.
b6cbc1c to
5554d6c
Compare
|
Rebased onto current Local checks here were limited to |
|
I'll get this passed over to QA. Once that passes, we'll get it merged. Thanks for the contribution! |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7652 +/- ##
==========================================
+ Coverage 61.49% 61.53% +0.03%
==========================================
Files 2253 2253
Lines 99103 99103
Branches 8960 8960
==========================================
+ Hits 60945 60984 +39
+ Misses 36007 35968 -39
Partials 2151 2151 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for contributing @singhvishalkr! |



Fixes #4845
When sending emergency access emails, names with special characters like German umlauts appear as HTML entities (e.g.,
Stephan Windmüllerinstead ofStephan Windmüller).The root cause is double HTML encoding:
CoreHelpers.SanitizeForEmail(name)encodes the name (htmlEncodedefaults totrue)Other email methods in the same file already pass
falseto avoid this (e.g.,SendProviderInviteEmailAsync). This change applies the same pattern to all emergency access email methods:SendEmergencyAccessInviteEmailAsyncSendEmergencyAccessConfirmedEmailAsyncSendEmergencyAccessRecoveryInitiatedSendEmergencyAccessRecoveryApprovedSendEmergencyAccessRecoveryRejectedSendEmergencyAccessRecoveryReminderSendEmergencyAccessRecoveryTimedOutTested by reviewing the code path and confirming the fix matches existing patterns.