yogthos/markdown-clj

Prevent potential XSS by default

Open

#188 opened on Oct 12, 2022

 (1 comment) (0 reactions) (0 assignees)Clojure (120 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (570 stars)
PR merge metrics
 (PR metrics pending)

Description

Example markdown:

[click me](javascript:window.onerror=alert;throw%20document.URL)

Markdown clj will render:

Maybe we force folks to specify specific protocols they want to support and validate the urls? We just discovered this and haven't done much analysis at this point.

This is what other popular Java markdown tools do:

https://github.com/commonmark/commonmark-java/blob/main/commonmark/src/main/java/org/commonmark/renderer/html/DefaultUrlSanitizer.java

Note, this doesn't affect other online editors either:

https://dillinger.io/ https://stackedit.io/app# https://jbt.github.io/markdown-editor/

Contributor guide