v145 · Security · Policy Conflict Tester

Policy conflict tester

Register multiple Trusted Types policies, attempt name collisions, and observe Chrome 145's spec-aligned behaviour — which previously silently overwrote the duplicate, now throws. Includes a CSP fix-up suggester.

scenarios

code

// Chrome 145 follows the spec strictly: createPolicy with a name that
// was already used throws a TypeError. Before 145, the second call
// silently won — a bug that masked policy collisions in real apps.

trustedTypes.createPolicy('sanitizer', { createHTML: DOMPurify.sanitize });
trustedTypes.createPolicy('sanitizer', { createHTML: x => x }); // TypeError in 145

see also