The vulnerability, GHSA-vvfj-2jqx-52jm, is a failure to enforce the noopener attribute on links generated by LaTeX typesetters in JupyterLab. This could expose users to reverse tabnabbing attacks if they are using a third-party extension that creates links with target="_blank".
The root cause of the vulnerability is that the rendering pipeline for various content types (HTML, Markdown, etc.) would invoke a LaTeX typesetter if needed, but it did not sanitize the HTML output of the typesetter to ensure that anchor tags (<a>) had the necessary security attributes (rel="noopener").
The patch addresses this issue at multiple levels of the rendering stack:
-
In the MathJax Extension: The MathJaxTypesetter.typeset method itself is modified to proactively harden the links it generates.
-
In the Core Renderers: The renderHTML and renderLatex functions in @jupyterlab/rendermime are updated to explicitly call a new hardenAnchorLinks function after the typesetter has run. This fixes a logical flaw where the previous link handling was done before the typesetter had even created the links.
-
In the Rendering Widgets: The RenderedHTML, RenderedLatex, RenderedMarkdown, and RenderedSVG widgets are all modified. The direct call to the typesetter is replaced with a call to a new Private.typeset helper function, which ensures that hardenAnchorLinks is called after the typesetting is complete, regardless of whether the typesetter runs synchronously or asynchronously.
By patching all these locations, the fix ensures that any links generated by the LaTeX typesetter are properly secured, mitigating the vulnerability across all the different ways content can be rendered in JupyterLab.