fix(security): remediate audit vulnerabilities SEC-001 through SEC-023
Deploy Canina / deploy (push) Successful in 2m25s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s

This commit is contained in:
parsa committed 2026-09-23 23:00:25 +03:30
1 parent dc88677169
commit bd49fbc4a0
31 files changed
+867 -114

No files matched your search

@@ -1,5 +1,6 @@
"use client";
import React, { useState, useEffect } from "react";
import DOMPurify from 'dompurify';
import {
ChevronRight,
Calendar,
@@ -175,7 +176,14 @@ export default function BlogPostClient({ blog, publishedDate, authorName }: Blog
{/* Main Rich Content HTML Renderer */}
<div
className="prose prose-base sm:prose-lg max-w-none text-medical-gray-700 leading-loose space-y-5 article-html-content"
dangerouslySetInnerHTML={{ __html: blog.content || '' }}
dangerouslySetInnerHTML={{
__html: typeof window !== 'undefined'
? DOMPurify.sanitize(blog.content || '', {
ADD_TAGS: ['iframe'],
ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling'],
})
: blog.content || '',
}}
/>
{/* Tags Chip Footer */}
@@ -2,6 +2,7 @@
'use client';
import React from 'react';
import DOMPurify from 'dompurify';
import { useSettingsStore } from '../lib/store/settingsStore';
const DEFAULT_ENAMAD_HTML = `<a referrerpolicy='origin' target='_blank' href='https://trustseal.enamad.ir/?id=765218&Code=dOdphRTqZwp3Kep5m07XwaqA0DTFh5ny'><img referrerpolicy='origin' src='https://trustseal.enamad.ir/logo.aspx?id=765218&Code=dOdphRTqZwp3Kep5m07XwaqA0DTFh5ny' alt='' style='cursor:pointer' code='dOdphRTqZwp3Kep5m07XwaqA0DTFh5ny'></a>`;
@@ -10,6 +11,14 @@ export default function EnamadBadge() {
const getText = useSettingsStore((state) => state.getText);
const enamadHtml = getText('ENAMAD_HTML_CODE', DEFAULT_ENAMAD_HTML);
const cleanEnamadHtml =
typeof window !== 'undefined'
? DOMPurify.sanitize(enamadHtml, {
ALLOWED_TAGS: ['a', 'img'],
ALLOWED_ATTR: ['referrerpolicy', 'target', 'href', 'src', 'alt', 'style', 'code', 'width', 'height'],
})
: enamadHtml;
return (
<div className="relative flex flex-col items-center justify-center p-6 bg-white/90 backdrop-blur-md rounded-2xl border border-gray-100 shadow-sm hover:shadow-md transition-all duration-300">
<div className="text-xs font-semibold text-teal-600 bg-teal-50 px-3 py-1 rounded-full mb-3">
@@ -18,7 +27,7 @@ export default function EnamadBadge() {
<div
className="relative min-w-[120px] min-h-[120px] flex items-center justify-center bg-white rounded-xl overflow-hidden border border-gray-100 p-2"
dangerouslySetInnerHTML={{ __html: enamadHtml }}
dangerouslySetInnerHTML={{ __html: cleanEnamadHtml }}
/>
<p className="text-xs text-gray-500 mt-4 text-center leading-relaxed font-medium">
@@ -3,6 +3,7 @@ import React, { useEffect, useState } from "react";
import { HelpCircle, ChevronDown } from "lucide-react";
import { motion, AnimatePresence } from "motion/react";
import { useSettingsStore } from "../lib/store/settingsStore";
import { safeJsonLd } from "../lib/schema";
import api from "../lib/services/api";
export interface FAQItem {
@@ -59,7 +60,7 @@ export default function FAQSection() {
{faqs.length > 0 && (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(faqSchema) }}
dangerouslySetInnerHTML={{ __html: safeJsonLd(faqSchema) }}
/>
)}
@@ -20,6 +20,7 @@ import {
Loader2
} from "lucide-react";
import { getMediaUrl } from "../lib/media";
import DOMPurify from "dompurify";
interface VideoModalPlayerProps {
isOpen: boolean;
@@ -306,7 +307,14 @@ export default function VideoModalPlayer({ isOpen, onClose, video }: VideoModalP
</button>
<div
className="w-full h-full [&>iframe]:w-full [&>iframe]:h-full"
dangerouslySetInnerHTML={{ __html: video.videoUrl || '' }}
dangerouslySetInnerHTML={{
__html: typeof window !== 'undefined'
? DOMPurify.sanitize(video.videoUrl || '', {
ALLOWED_TAGS: ['iframe'],
ALLOWED_ATTR: ['src', 'width', 'height', 'frameborder', 'allow', 'allowfullscreen', 'title'],
})
: video.videoUrl || '',
}}
/>
</div>
) : (
@@ -1,6 +1,7 @@
"use client";
import React from "react";
import DOMPurify from "dompurify";
import SafeImage from "../SafeImage";
import { Product } from "../../lib/data/products";
import { X, ShieldCheck, CheckCircle2, Award, Stethoscope, Sparkles, Layers, Info } from "lucide-react";
@@ -77,7 +78,11 @@ export default function ProductDetailModal({ product, categoryColor = "#0284C7",
</span>
{/<[a-z][\s\S]*>/i.test(product.description || '') ? (
<div
dangerouslySetInnerHTML={{ __html: product.description || '' }}
dangerouslySetInnerHTML={{
__html: typeof window !== 'undefined'
? DOMPurify.sanitize(product.description || '')
: product.description || '',
}}
className="text-sm text-slate-600 leading-relaxed font-medium space-y-2 [&>h1]:font-black [&>h2]:font-black [&>h3]:font-black [&>p]:leading-relaxed [&>ul]:list-disc [&>ul]:pr-4 [&>ol]:list-decimal [&>ol]:pr-4 text-justify"
/>
) : (