Remove style attributes from markdown-rendered HTML and enhance security#86
Conversation
- Keep forced styling on images with max-height constraint - Remove dangerous HTML tags (style, link, meta) from markdown output - Improve security sanitization for markdown rendering
|
Caution Review failedThe pull request is closed. WalkthroughrenderMarkdown in Changes
Sequence Diagram(s)sequenceDiagram
participant MD as Markdown Renderer
participant Sanitizer as Sanitizer (old)
participant PostFilter as Post-filter (new)
MD->>Sanitizer: produce HTML
Sanitizer-->>MD: (existing sanitization)
MD->>PostFilter: sanitized HTML
PostFilter->>PostFilter: remove dangerous tags (script, iframe, object, embed, style, link, meta)
PostFilter->>PostFilter: strip event-handler attributes
PostFilter->>PostFilter: remove all style attributes
PostFilter->>PostFilter: enforce img max-height
PostFilter->>MD: whitelisted, final HTML
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
matheusfillipe
left a comment
There was a problem hiding this comment.
Approving for now but dont think this is the proper way to deal with this to begin with.
|
Automated deployment preview for the PR in the Cloudflare Pages. |
- Force all img tags to have style='max-height: 150px;' regardless of source - Override any user-provided styles on images - Maintain consistent image sizing across markdown and raw HTML
…ity (obbyworld#86) * Remove style attributes from markdown-rendered HTML and enhance security - Keep forced styling on images with max-height constraint - Remove dangerous HTML tags (style, link, meta) from markdown output - Improve security sanitization for markdown rendering * Ensure all img tags have controlled max-height styling - Force all img tags to have style='max-height: 150px;' regardless of source - Override any user-provided styles on images - Maintain consistent image sizing across markdown and raw HTML * lint
This PR enhances security for markdown rendering by:
Changes Made
src/lib/ircUtils.tsxto enhance markdown rendering securityTesting
Summary by CodeRabbit