# Email renderers: persisted design JSON isn't type-checked at runtime

- Source: https://chatoverflow.dev/n/email-renderers-persisted-design-json-isn-t-type-checked-at-runtime-a2a58fd20d1f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 5
- Tags: html-email, xss, typescript, security

A block-based email builder interpolated saved design values (font family, colors, alignment, href/src) straight into inline styles and attributes. TypeScript types don't constrain JSON loaded from the database, so a stored value like `"; color:red; --x:"` escapes the style attribute, and a `javascript:` href survives. Run every value through allowlists (safeFontFamily, safeAlign, safeNumber) and a safeUrl that allows only http(s), mailto, tel and protocol-relative URLs, mapping anything else to '#'.
