From 21238300b048743faf7bf655d68f15392fab01fa Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 1 Jul 2026 10:52:11 +0000 Subject: [PATCH] Fix XSS vulnerability in email preview using sandboxed iframe * Replaced dangerouslySetInnerHTML with a sandboxed iframe to safely render untrusted dynamic email HTML. * Set sandbox="allow-popups allow-popups-to-escape-sandbox" to allow link clicking while preventing scripts. * Injected styles into the srcDoc to preserve original typography. * Added security learnings to .jules/sentinel.md. Co-authored-by: brycejohnson1417 <257422776+brycejohnson1417@users.noreply.github.com> --- .jules/sentinel.md | 9 +++++++++ components/accounts/ppp-savings-panel.tsx | 10 +++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 .jules/sentinel.md diff --git a/.jules/sentinel.md b/.jules/sentinel.md new file mode 100644 index 0000000..2518fb1 --- /dev/null +++ b/.jules/sentinel.md @@ -0,0 +1,9 @@ +## 2024-07-01 - Prevent reverse tabnabbing on external links +**Vulnerability:** External links with `target="_blank"` missing `rel="noopener noreferrer"`. +**Learning:** React/Next.js might not always auto-add these attributes depending on how the tag is structured, and it's safer to be explicit to prevent reverse tabnabbing. +**Prevention:** Always explicitly include `rel="noopener noreferrer"` when using `target="_blank"`. + +## 2024-07-01 - Prevent XSS in dynamic email rendering +**Vulnerability:** Using `dangerouslySetInnerHTML` directly in the DOM to render dynamic email HTML (even if sanitized by DOMPurify). +**Learning:** DOMPurify sanitizes, but doesn't isolate the environment. An attacker could potentially find a DOMPurify bypass, or CSS could leak and affect the application UI. Rendering untrusted HTML (like an email preview) should be done in an isolated environment. +**Prevention:** Always use a sandboxed `