Open sgoedecke opened 2 years ago
With ui/safe enabled, it's still possible to render javascript: protocol links by including \n or \r characters in the protocol.
ui/safe
javascript:
\n
\r
Go to this codepen: https://codepen.io/sgoedecke/pen/KKQJyPw
Rendering this notebook with the ui/safe extension will create a link that when clicked executes that JS alert(1) code. Explicitly adding
alert(1)
safeOptions: { allow: { URLs: 'safe' }, safeProtocols: { http: 'true', https: 'true', javascript: 'false' } }
doesn't fix the problem.
I am using the following MathJax configuration:
window.MathJax = { loader: { load: ['ui/safe'] } };
and loading MathJax via <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
I've submitted a PR with a fix here: https://github.com/mathjax/MathJax-src/pull/829. If you agree with this fix, I'd like to also port it to the legacy-v2-develop branch.
legacy-v2-develop
Issue Summary
With
ui/safe
enabled, it's still possible to renderjavascript:
protocol links by including\n
or\r
characters in the protocol.Steps to Reproduce:
Go to this codepen: https://codepen.io/sgoedecke/pen/KKQJyPw
Rendering this notebook with the
ui/safe
extension will create a link that when clicked executes that JSalert(1)
code. Explicitly addingdoesn't fix the problem.
Technical details:
I am using the following MathJax configuration:
and loading MathJax via
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
Supporting information: