From abd493fb4c5881dc23c21e2eea41419fbdc7986a Mon Sep 17 00:00:00 2001 From: Stefan Hildebrandt <695494+hildebrandttk@users.noreply.github.com> Date: Tue, 23 Jun 2026 08:23:10 +0200 Subject: [PATCH] feat: strip external url()/@import from ', + ).body.firstElementChild!; + expect(blockExternalResourcesOnNode(style)).toBe(true); + expect(style.textContent).toBe('#x{background:url()}'); + }); + }); + describe('blockExternalResourcesOnNode (anti-tracking vectors)', () => { function el(html: string): Element { return parseHtmlSafely(`${html}`).body.firstElementChild!; diff --git a/lib/email-sanitization.ts b/lib/email-sanitization.ts index 69afdc3d..81a8f5a9 100644 --- a/lib/email-sanitization.ts +++ b/lib/email-sanitization.ts @@ -243,6 +243,43 @@ export function stripExternalCssUrls(style: string): string { ); } +/** + * Neutralise external references in a full stylesheet (a kept `