IntelOwl icon indicating copy to clipboard operation
IntelOwl copied to clipboard

Raw HTML rendered as text in Notifications Dropdown

Open Prasad8830 opened this issue 8 months ago • 5 comments

Description

Notifications in the dropdown display raw HTML (e.g., <h2>, <p>, <a>) instead of properly rendered content.

Expected Behavior

HTML content should be parsed and displayed as formatted text with styling and clickable links.

Actual Behavior

HTML is escaped and shown as plain text.

Root Cause

ReactMarkdown escapes HTML by default, while the backend is sending HTML instead of Markdown.

Suggested Fix

Enable HTML rendering using rehype-raw:

import rehypeRaw from "rehype-raw";

<ReactMarkdown rehypePlugins={[rehypeRaw]}>
  {notif?.body}
</ReactMarkdown>
Steps to Reproduce
Open Notifications dropdown
View system notifications
Observe raw HTML displayed
Notes

If enabling rehype-raw, ensure content is trusted to avoid XSS risks.

Prasad8830 avatar Mar 22 '26 21:03 Prasad8830

I would like to work on this issue. Please assign it to me if approved.

Prasad8830 avatar Mar 22 '26 21:03 Prasad8830

whats the difference between this and the fix made in #3350

IshaanXCoder avatar Mar 23 '26 06:03 IshaanXCoder

Hi @IshaanXCoder, I think both are the same, but the bug is still present.

Prasad8830 avatar Mar 23 '26 12:03 Prasad8830

You can see the change by building the develop branch.

sanjib2006 avatar Mar 23 '26 19:03 sanjib2006

thanks @IshaanXCoder for pointing this out

mlodic avatar Mar 23 '26 21:03 mlodic