Repository navigation
build: override Mermaid's KaTeX to 0.18, drop the which dependency - #1199
Merged
juliasilge merged 2 commits intoOct 14, 2026
Merged
Conversation
Mermaid 11.17.2 asks for katex ^0.16.47, which has GHSA-238p-pmpm-9mq7 (fixed in 0.18.2). Mermaid 12.2 moved to ^0.18.0 with no change to how it calls katex, so the override is safe. Drop it once mermaid is >=12.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its only use was resolving a bare Python command name against PATH, which a small local helper now does. which 7 needs Node >=22.22, newer than our oldest supported extension host, so this also removes a Dependabot ignore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
| Status | Scan Engine | Total (0) | ||||
|---|---|---|---|---|---|---|
| Open Source Security | 0 | 0 | 0 | 0 | See details | |
| Licenses | 0 | 0 | 0 | 0 | See details |
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small dependency cleanups.
Changes
katex ^0.16.47, which has GHSA-238p-pmpm-9mq7 (low: prototype pollution elsewhere on the page can turn on KaTeX'strustoption). The fix is in 0.18.2, and no 0.16.x release has it. The rootpackage.jsonnow has"overrides": { "mermaid": { "katex": "^0.18.2" } }, which resolves to 0.18.10.katex ^0.18.0, and its KaTeX code (renderKatexUnsanitized: dynamicimport("katex"), thenrenderToStringwith MathML output by default) is identical to 11.17.2's. KaTeX's breaking changes don't apply here. 0.17 changed an internal__defineFunctionAPI, and 0.18 prefixes KaTeX's CSS classes, which only matters for HTML output styled by KaTeX's stylesheet. We use MathML output and don't load that stylesheet.overridescan't carry a comment, so this is recorded here.npm audit, Dependabot and Snyk, so it doesn't sit open until Mermaid 12. The one place it changes code is the notebook renderer, where the advisory already couldn't do harm: the renderer shows Mermaid's SVG as an<img>data URL, so links, scripts and external resources in it are inert.assets/www/diagram/mermaid.min.jsis Mermaid's prebuilt bundle with KaTeX 0.16.47 compiled in, so no override or lockfile change reaches it. It's also the more exposed of the two, sincediagram.jsinserts the SVG withinnerHTML(after Mermaid's defaultstrictDOMPurify pass). Fixing it needs Mermaid 12, or bundling Mermaid for the preview ourselves. Scanners don't see that file.which(and@types/which). It was used once, inactivePythonInterpreter, to resolve a barepythonname from the Python extension againstPATH. A small localfindOnPathhelper now does that, following which@3's rules:PATHEXTon Windows, quotedPATHentries, executable files only. Names with a directory part are left as they are, as before. which 7 needs Node ≥22.22, newer than VS Code 1.101's extension host, so this also removes a reason for a Dependabot ignore (build: add Dependabot for npm dependencies #1198).Verification
package-lock.jsondiff: onlywhich,@types/which, andkatex0.16.47 → 0.18.10 (with its CLI'scommander8 → 15, which isn't bundled).npm ls --allexits 0.npm audit --omit=dev: 2 low → 0.npm run build -- --force: 9/9. The notebook renderer'sout/markdownit/katex-*.jschunk is 0.18.10.npm run lint -- --continue: 17/17, 0 errors, 17 warnings (unchanged).npm run test-packages: 13/13.mermaid.core.mjs, so it uses our KaTeX): a flowchart with$$x^2 + \frac{a}{b}$$and$$\sqrt{\alpha}$$labels and a sequence diagram with$$\sum_{i=1}^n i$$render with<math>elements, no syntax error, and no console errors or warnings.findOnPathgives the same result ascommand -vforpython3,python(absent),node,gitand a missing name, on macOS. Not checked on Windows.🤖 Generated with Claude Code