Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix discussion XSS issue
Browse files Browse the repository at this point in the history
  • Loading branch information
awaisdar001 committed Aug 4, 2021
1 parent 20447e5 commit f1e2d96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/static/common/js/discussion/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@
var RE_DISPLAYMATH = /^([^\$]*?)\$\$([^\$]*?)\$\$(.*)$/m,
RE_INLINEMATH = /^([^\$]*?)\$([^\$]+?)\$(.*)$/m,
ESCAPED_DOLLAR = '@@ESCAPED_D@@',
ESCAPED_BACKSLASH = '@@ESCAPED_B@@';
ESCAPED_BACKSLASH = '@@ESCAPED_B@@',
LATEX_SCRIPT = '\{javascript\:(.+?)\}';

/**
* Formats math and code chunks
Expand Down Expand Up @@ -417,6 +418,7 @@
return processor(('\\begin{' + $1 + '}') + $2 + ('\\end{' + $1 + '}'));
});
htmlString = htmlString.replace(new RegExp(ESCAPED_BACKSLASH, 'g'), '\\\\\\\\');
htmlString = htmlString.replace(new RegExp(LATEX_SCRIPT, 'g'), '{}');
$div = edx.HtmlUtils.setHtml($('<div>'), edx.HtmlUtils.HTML(htmlString));
$div.find('code').each(function(index, code) {
edx.HtmlUtils.setHtml(
Expand Down

0 comments on commit f1e2d96

Please sign in to comment.