Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions src/feature/album/4cut/components/Container4CutExplanation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function Container4CutExplanation({
}: Container4CutExplanationProps) {
const calculatedWidth = width ?? BASE_WIDTH * scale;
const calculatedHeight = calculatedWidth * BASE_ASPECT_RATIO;
const { aiSummary, isLoading } = use4CutAiSummary(albumId);
const { aiSummary } = use4CutAiSummary(albumId);

return (
<div
Expand All @@ -53,29 +53,23 @@ export default function Container4CutExplanation({
)}
</div>
{/* X 버튼 */}
<button
onClick={onClose}
className='rounded-full p-1 transition-colors hover:bg-gray-100'
aria-label='닫기'
>
<X className='text-text-secondary h-5 w-5' />
</button>
<div className='bg-element-primary-light flex h-8 w-8 items-center justify-center rounded-full'>
<button
onClick={onClose}
className='flex items-center justify-center'
aria-label='닫기'
>
<X className='text-text-secondary h-5 w-5' />
</button>
</div>
</div>

{/* Body: 텍스트 설명 */}
<div className='flex h-full flex-col justify-center p-4'>
<div className='bg-surface-white rounded-lg p-4'>
{isLoading ? (
<div className='flex items-center justify-center py-8'>
<div className='text-text-secondary text-sm'>
AI 요약 생성 중...
</div>
</div>
) : (
<p className='text-text-basic text-sm leading-relaxed whitespace-pre-wrap'>
{aiSummary}
</p>
)}
<div className='flex h-full flex-col justify-start px-4'>
<div className='bg-surface-white h-[320px] rounded-lg p-4'>
<p className='text-text-basic text-sm leading-relaxed whitespace-pre-wrap'>
{aiSummary}
</p>
Comment on lines +70 to +72
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The aiSummary variable, which contains AI-generated content from the use4CutAiSummary hook, is rendered directly to the UI without sanitization. This poses a content injection vulnerability, as an attacker could inject malicious text or links, deceiving users. While React's JSX escaping prevents XSS, it doesn't mitigate risks from LLM-generated content. It is crucial to implement a sanitization process (e.g., using DOMPurify) before displaying aiSummary to strip harmful HTML and validate content. Additionally, the loading state UI for AI summary generation has been removed, which negatively impacts user experience. The use4CutAiSummary hook fetches data asynchronously, and aiSummary might be an empty string during loading, showing a blank box. Reintroduce a clear loading indicator (e.g., skeleton UI or "AI 요약 생성 중...") using the isLoading state to inform users about the ongoing process.

</div>
</div>
</div>
Expand Down
Loading