Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2026-07-08 - XSS Prevention via Sandboxed iframes
**Vulnerability:** Used dangerouslySetInnerHTML for email preview rendering, presenting an XSS risk even when used with DOMPurify.
**Learning:** To prevent XSS when rendering dynamic or untrusted HTML like email previews, an isolated browsing context is safer.
**Prevention:** Prioritize using a sandboxed <iframe> with the srcDoc attribute instead of dangerouslySetInnerHTML. Use sandbox='allow-popups allow-popups-to-escape-sandbox' to permit link clicking while omitting allow-scripts.
6 changes: 5 additions & 1 deletion components/accounts/ppp-savings-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ export function PppSavingsPanel({ orgSlug, accountId }: PppSavingsPanelProps) {
</div>
</div>
<div className="min-h-[24rem] w-full overflow-auto bg-white p-6 text-sm text-black">
<div dangerouslySetInnerHTML={{ __html: sanitizedEmailHtml }} />
<iframe

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add a title to the email preview iframe

Because this new iframe renders the PPP savings email preview without a title, assistive technologies expose it as an unnamed frame; users navigating the account panel by frames cannot tell what content they are entering. This file was part of the recent accessibility pass, so please give the iframe a descriptive title such as PPP savings email preview.

Useful? React with πŸ‘Β / πŸ‘Ž.

srcDoc={`<style>body { font-family: sans-serif; font-size: 14px; color: black; margin: 0; padding: 0; }</style>${sanitizedEmailHtml}`}
sandbox="allow-popups allow-popups-to-escape-sandbox"
className="h-full min-h-[24rem] w-full border-0"
/>
</div>
</div>
</div>
Expand Down
Loading