Skip to content

Commit ade348e

Browse files
author
Daniel Neto
committed
feat(markDownToHTML): enable safe mode and escape markup to prevent XSS vulnerabilities
1 parent 37c84f8 commit ade348e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

objects/functionsSecurity.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ function isBot($returnTrueIfNoUserAgent=true)
349349
function markDownToHTML($text) {
350350
$parsedown = new Parsedown();
351351

352+
// Enable safe mode to prevent XSS via raw HTML in markdown input
353+
$parsedown->setSafeMode(true);
354+
// Also escape any markup that bypasses safe mode
355+
$parsedown->setMarkupEscaped(true);
356+
352357
// Convert Markdown to HTML
353358
$html = $parsedown->text($text);
354359

0 commit comments

Comments
 (0)