Skip to content

[P2] Audit: Markdown, HTML, and SVG preview tools need explicit sanitization tests #151

Description

@baixiangcpp

Imported from the byteflow.tools deep audit on 2026-06-22.

Problem: tools that preview or transform user-controlled markup need explicit test coverage for safe rendering. Markdown Preview, HTML to Markdown, SVG Optimizer, SVG to PNG Converter, Open Graph preview, and similar tools should not rely only on manual review.

Affected tools:

  • Markdown Preview
  • HTML to Markdown
  • SVG Optimizer
  • SVG to PNG Converter
  • Open Graph Meta Generator
  • Any tool rendering user-provided HTML/SVG/metadata

Reproduction steps:

  1. Open markup preview tools.
  2. Test harmless inputs that mimic scripts, event handlers, iframes, external references, and SVG foreign content.
  3. Verify whether content is sanitized, escaped, sandboxed, or rejected.
  4. Check the CSP and console output.

Expected behavior: unsafe markup should not execute. Rendering should be sanitized, sandboxed, or safely escaped, and tests should enforce this.

Actual behavior: Trust Center mentions sanitization expectations, but explicit automated coverage needs confirmation.

Impact: user-content rendering risks can undermine trust and create security issues if a future change relaxes sanitization.

Proposed fix:

  • Add a sanitizer test suite for markdown, HTML, SVG, and OG preview components.
  • Add regression tests for script-like input, event attributes, external references, iframe-like content, and SVG special cases.
  • Enforce CSP compatibility.
  • Document the sanitization boundary per tool.

Acceptance criteria:

  • Unsafe user-controlled markup never executes in tests.
  • Sanitized output is predictable and visible to users.
  • CSP does not need unsafe relaxations for previews.
  • New preview tools must include sanitization tests before launch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions