diff options
| author | Fuwn <[email protected]> | 2026-02-08 09:22:21 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-08 09:22:21 -0800 |
| commit | 220039181755a7ac5b5f3691bb298336f8abeb50 (patch) | |
| tree | 60a29ef9e6e5b82bb32a8a8e32b52bd5faace00f /apps/web | |
| parent | security: harden API routes (diff) | |
| download | asa.news-220039181755a7ac5b5f3691bb298336f8abeb50.tar.xz asa.news-220039181755a7ac5b5f3691bb298336f8abeb50.zip | |
security: sanitize HTML in marketing demo
Apply sanitizeEntryContent() to dangerouslySetInnerHTML in the
interactive demo component. Content comes from the database and
should be sanitized before rendering on the public marketing page.
Diffstat (limited to 'apps/web')
| -rw-r--r-- | apps/web/app/(marketing)/_components/interactive-demo.tsx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/web/app/(marketing)/_components/interactive-demo.tsx b/apps/web/app/(marketing)/_components/interactive-demo.tsx index a1c3755..3dbcec0 100644 --- a/apps/web/app/(marketing)/_components/interactive-demo.tsx +++ b/apps/web/app/(marketing)/_components/interactive-demo.tsx @@ -3,6 +3,7 @@ import { useState } from "react" import { formatDistanceToNow } from "date-fns" import { classNames } from "@/lib/utilities" +import { sanitizeEntryContent } from "@/lib/sanitize" import type { ShowcaseEntry, ShowcaseFeed } from "./showcase-types" function estimateReadingTimeMinutes(html: string): number { @@ -156,7 +157,7 @@ function DemoDetailPane({ entry }: { entry: ShowcaseEntry | null }) { {entry.contentHtml ? ( <div className="prose-reader text-text-secondary" - dangerouslySetInnerHTML={{ __html: entry.contentHtml }} + dangerouslySetInnerHTML={{ __html: sanitizeEntryContent(entry.contentHtml) }} /> ) : entry.summary ? ( <p className="text-text-secondary">{entry.summary}</p> @@ -201,7 +202,7 @@ function DemoMobileDetail({ {entry.contentHtml ? ( <div className="prose-reader text-text-secondary" - dangerouslySetInnerHTML={{ __html: entry.contentHtml }} + dangerouslySetInnerHTML={{ __html: sanitizeEntryContent(entry.contentHtml) }} /> ) : entry.summary ? ( <p className="text-text-secondary">{entry.summary}</p> |