fix(security): sanitize dynamic HTML rendering in Hero and ProductPage [FE-006]
This commit is contained in:
1 parent
15524609fe
commit
d3aa10c769
2 files changed
+4
-2
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { sanitizeBlogHtml } from "../lib/sanitizeBlogHtml";
|
||||
import Image from "next/image";
|
||||
import { motion, AnimatePresence, animate } from "motion/react";
|
||||
import { ChevronLeft, ChevronRight, Globe, ShieldCheck, Calendar, ArrowLeft } from "lucide-react";
|
||||
@@ -134,7 +135,7 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
|
||||
suppressHydrationWarning
|
||||
className="text-sm lg:text-xl text-medical-gray-600 mb-3 sm:mb-5 max-w-2xl mx-auto lg:mx-0 leading-relaxed font-vazir animate-fade-in [&_p]:text-sm [&_p]:lg:text-xl [&_p]:leading-relaxed [&_p]:my-0 [&_span]:text-inherit"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: subtitle
|
||||
__html: sanitizeBlogHtml(subtitle)
|
||||
}}
|
||||
/>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { sanitizeBlogHtml } from "../lib/sanitizeBlogHtml";
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
"use client";
|
||||
import Link from "next/link";
|
||||
@@ -880,7 +881,7 @@ export default function ProductPage({
|
||||
}`}
|
||||
>
|
||||
<div
|
||||
dangerouslySetInnerHTML={{ __html: formattedHtml }}
|
||||
dangerouslySetInnerHTML={{ __html: sanitizeBlogHtml(formattedHtml) }}
|
||||
className="rich-product-description space-y-3 font-vazir text-justify leading-relaxed sm:leading-loose [&>h1]:text-lg [&>h1]:sm:text-xl [&>h1]:font-black [&>h1]:text-medical-gray-900 [&>h1]:mt-4 [&>h1]:mb-2 [&>h2]:text-base [&>h2]:sm:text-lg [&>h2]:font-black [&>h2]:text-medical-gray-900 [&>h2]:mt-3 [&>h2]:mb-1.5 [&>h3]:text-sm [&>h3]:sm:text-base [&>h3]:font-black [&>h3]:text-medical-gray-900 [&>h3]:mt-3 [&>h3]:mb-1 [&>h4]:text-xs [&>h4]:sm:text-sm [&>h4]:font-bold [&>h4]:text-medical-gray-800 [&>p]:leading-relaxed [&>p]:sm:leading-loose [&>ul]:list-disc [&>ul]:pr-5 [&>ul]:space-y-1 [&>ol]:list-decimal [&>ol]:pr-5 [&>ol]:space-y-1 [&>table]:w-full [&>table]:border-collapse [&>table]:my-3 [&>table_th]:border [&>table_th]:border-medical-gray-200 [&>table_th]:p-2 [&>table_th]:bg-medical-gray-100 [&>table_td]:border [&>table_td]:border-medical-gray-200 [&>table_td]:p-2 [&>hr]:my-4 [&>hr]:border-medical-gray-200 [&>blockquote]:border-r-4 [&>blockquote]:border-canina-blue [&>blockquote]:pr-3 [&>blockquote]:italic [&>blockquote]:bg-canina-blue/5 [&>blockquote]:p-2 [&>blockquote]:rounded-l-lg [&>img]:rounded-xl [&>img]:my-3 [&>img]:max-w-full [&>img]:shadow-sm"
|
||||
/>
|
||||
|
||||
|
||||
Reference in new issue
Block a user