zitadel/internal/notification/types
Livio Spring 189505c80f
fix: sanitize output for email (#8373)
# Which Problems Are Solved

ZITADEL uses HTML for emails and renders certain information such as
usernames dynamically. That information can be entered by users or
administrators. Due to a missing output sanitization, these emails could
include malicious code.
This may potentially lead to a threat where an attacker, without
privileges, could send out altered notifications that are part of the
registration processes. An attacker could create a malicious link, where
the injected code would be rendered as part of the email.

During investigation of this issue a related issue was found and
mitigated, where on the user's detail page the username was not
sanitized and would also render HTML, giving an attacker the same
vulnerability.

While it was possible to inject HTML including javascript, the execution
of such scripts would be prevented by most email clients and the Content
Security Policy in Console UI.

# How the Problems Are Solved

- All arguments used for email are sanitized (`html.EscapeString`)
- The email text no longer `html.UnescapeString` (HTML in custom text is
still possible)
- Console no longer uses `[innerHtml]` to render the username

# Additional Changes

None

# Additional Context

- raised via email

---------

Co-authored-by: peintnermax <max@caos.ch>
2024-07-31 14:21:10 +02:00
..
domain_claimed.go fix: use triggering origin for notification links (#6628) 2023-10-10 13:20:53 +00:00
email_verification_code_test.go feat: pass and handle auth request context for email links (#7815) 2024-04-24 17:50:58 +02:00
email_verification_code.go feat: pass and handle auth request context for email links (#7815) 2024-04-24 17:50:58 +02:00
init_code.go feat: pass and handle auth request context for email links (#7815) 2024-04-24 17:50:58 +02:00
notification.go fix: sanitize output for email (#8373) 2024-07-31 14:21:10 +02:00
otp.go refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
password_change.go fix: use triggering origin for notification links (#6628) 2023-10-10 13:20:53 +00:00
password_code.go feat: pass and handle auth request context for email links (#7815) 2024-04-24 17:50:58 +02:00
passwordless_registration_link_test.go refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
passwordless_registration_link.go fix: use triggering origin for notification links (#6628) 2023-10-10 13:20:53 +00:00
phone_verification_code.go fix: use triggering origin for notification links (#6628) 2023-10-10 13:20:53 +00:00
templateData.go refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
types_test.go feat: implement register Passkey user API v2 (#5873) 2023-05-24 10:22:00 +00:00
user_email.go refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
user_phone.go refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
webhook.go fix: use triggering origin for notification links (#6628) 2023-10-10 13:20:53 +00:00
without_template.go feat: call webhooks at least once (#5454) 2023-03-28 22:09:06 +00:00