diff --git a/src/components/common/FormattedDescription.tsx b/src/components/common/FormattedDescription.tsx index da81583..a1924ee 100644 --- a/src/components/common/FormattedDescription.tsx +++ b/src/components/common/FormattedDescription.tsx @@ -1,5 +1,6 @@ import * as React from "react"; import { cn } from "@/components/ui/utils"; +import { sanitizeHTML } from "@/utils/sanitizer"; interface FormattedDescriptionProps { content: string; @@ -33,7 +34,8 @@ export function FormattedDescription({ content, className }: FormattedDescriptio return `
${match}
`; }); - return processed; + // Sanitize the content to prevent CSP violations (onclick, style tags, etc.) + return sanitizeHTML(processed); }, [content]); if (!content) return null; diff --git a/src/components/modals/WorkNoteModal.tsx b/src/components/modals/WorkNoteModal.tsx index f7cf4f0..836370b 100644 --- a/src/components/modals/WorkNoteModal.tsx +++ b/src/components/modals/WorkNoteModal.tsx @@ -1,18 +1,19 @@ import React, { useState, useRef, useEffect } from 'react'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/dialog'; +import { sanitizeHTML } from '../../utils/sanitizer'; import { Button } from '../ui/button'; import { Input } from '../ui/input'; import { Avatar, AvatarFallback } from '../ui/avatar'; import { Badge } from '../ui/badge'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs'; import { ScrollArea } from '../ui/scroll-area'; -import { - Send, - Smile, - Paperclip, - Users, - FileText, - Download, +import { + Send, + Smile, + Paperclip, + Users, + FileText, + Download, Eye, MoreHorizontal } from 'lucide-react'; @@ -166,7 +167,8 @@ export function WorkNoteModal({ open, onClose, requestId }: WorkNoteModalProps) const formatMessage = (content: string) => { // Simple mention highlighting - return content.replace(/@(\w+\s?\w+)/g, '@$1'); + const formatted = content.replace(/@(\w+\s?\w+)/g, '@$1'); + return sanitizeHTML(formatted); }; return ( @@ -187,7 +189,7 @@ export function WorkNoteModal({ open, onClose, requestId }: WorkNoteModalProps) Chat Media - +
@@ -195,16 +197,15 @@ export function WorkNoteModal({ open, onClose, requestId }: WorkNoteModalProps)
{!msg.isSystem && ( - + 'bg-re-light-green' + }`}> {msg.user.avatar} )} - +
{msg.isSystem ? (
@@ -222,7 +223,7 @@ export function WorkNoteModal({ open, onClose, requestId }: WorkNoteModalProps) {msg.timestamp}
-
@@ -300,15 +301,14 @@ export function WorkNoteModal({ open, onClose, requestId }: WorkNoteModalProps)

Participants

{participants.length}
- +
{participants.map((participant, index) => (
- + {participant.avatar} diff --git a/src/components/ui/chart.tsx b/src/components/ui/chart.tsx index b49bc36..6332ce2 100644 --- a/src/components/ui/chart.tsx +++ b/src/components/ui/chart.tsx @@ -54,13 +54,13 @@ function ChartContainer({
- {children} @@ -69,37 +69,39 @@ function ChartContainer({ ); } -const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { +const getChartStyle = (config: ChartConfig) => { const colorConfig = Object.entries(config).filter( ([, config]) => config.theme || config.color, ); if (!colorConfig.length) { - return null; + return {}; } - return ( -