Skip to content

fix(make-pdf): replace regex sanitizer with parser-backed sanitization#1450

Open
arpitjain099 wants to merge 1 commit into
garrytan:mainfrom
arpitjain099:fix/make-pdf-parser-sanitizer
Open

fix(make-pdf): replace regex sanitizer with parser-backed sanitization#1450
arpitjain099 wants to merge 1 commit into
garrytan:mainfrom
arpitjain099:fix/make-pdf-parser-sanitizer

Conversation

@arpitjain099
Copy link
Copy Markdown

@arpitjain099 arpitjain099 commented May 12, 2026

Summary

  • replace make-pdf's regex-based HTML sanitizer with sanitize-html to reduce bypass risk from malformed-but-browser-accepted markup
  • keep markdown-oriented tags while dropping active/embed surfaces (scripts, iframes, forms, event handlers, javascript: URLs)
  • update sanitizer unit tests to reflect stricter URL/SVG handling and keep existing coverage passing

Why

Code scanning flags the previous regex approach as incomplete tag/attribute sanitization. A parser-backed sanitizer is more robust and easier to reason about for untrusted markdown-to-HTML conversion.

Verification

  • bun test make-pdf/test/render.test.ts
  • bun test make-pdf/test/

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant