Skip to main content

Text setting may be rendered as unsafe HTML

Investigates merchant-configurable text rendered as HTML without sanitization.

DetailValue
Check IDTEXT_SETTING_HTML_SMUGGLING
SeverityHigh
How it runsAgent review

app/components/BannerPreview.tsx

type Props = { settings: { headline: string } };

export function BannerPreview({ settings }: Props) {
// A merchant-editable text setting rendered as raw HTML.
// A value like <img src=x onerror=...> runs on the client.
return (
<div dangerouslySetInnerHTML={{ __html: settings.headline }} />
);
}

Render settings as text or sanitize with a strict allowlist.

app/components/BannerPreview.tsx

type Props = { settings: { headline: string } };

export function BannerPreview({ settings }: Props) {
// Render the setting as text. If the feature really needs rich
// text, sanitize with a strict allowlist on the server before
// it is stored.
return <div>{settings.headline}</div>;
}


Was this page helpful?