Skip to content

Docs page renders markdown as unsanitized HTML via marked #63

@FuturMix

Description

@FuturMix

Summary

apps/logicsrc-web/src/app/docs/[slug]/page.tsx line 40 parses markdown with marked and renders it via dangerouslySetInnerHTML at line 53 without sanitization.

const html = await marked.parse(md);
// ...
dangerouslySetInnerHTML={{ __html: html }}

Impact

The marked library converts markdown to HTML without sanitization by default. Markdown files can contain raw HTML (including <script> tags) that would be rendered unsanitized. While docs are sourced from the repo (lower risk than the blog webhook), a malicious contributor could inject JavaScript via a docs PR.

Suggested Fix

Configure marked with a sanitizer or pass output through sanitize-html:

import sanitizeHtml from "sanitize-html";
const rawHtml = await marked.parse(md);
const html = sanitizeHtml(rawHtml, { /* safe defaults */ });

Severity: Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions