Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency highlight.js [security] - autoclosed #367

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link

@renovate renovate bot commented Jun 18, 2022

Mend Renovate

This PR contains the following updates:

Package Change
highlight.js 10.2.0 -> 10.4.1
highlight.js 9.15.10 -> 9.18.2

GitHub Vulnerability Alerts

GHSA-7wwv-vh3v-89cq

Impact: Potential ReDOS vulnerabilities (exponential and polynomial RegEx backtracking)

oswasp:

The Regular expression Denial of Service (ReDoS) is a Denial of Service attack, that exploits the fact that most Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size). An attacker can then cause a program using a Regular Expression to enter these extreme situations and then hang for a very long time.

If are you are using Highlight.js to highlight user-provided data you are possibly vulnerable. On the client-side (in a browser or Electron environment) risks could include lengthy freezes or crashes... On the server-side infinite freezes could occur... effectively preventing users from accessing your app or service (ie, Denial of Service).

This is an issue with grammars shipped with the parser (and potentially 3rd party grammars also), not the parser itself. If you are using Highlight.js with any of the following grammars you are vulnerable. If you are using highlightAuto to detect the language (and have any of these grammars registered) you are vulnerable. Exponential grammars (C, Perl, JavaScript) are auto-registered when using the common grammar subset/library require('highlight.js/lib/common') as of 10.4.0 - see https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.4.0/build/highlight.js

All versions prior to 10.4.1 are vulnerable, including version 9.18.5.

Grammars with exponential backtracking issues:

  • c-like (c, cpp, arduino)
  • handlebars (htmlbars)
  • gams
  • perl
  • jboss-cli
  • r
  • erlang-repl
  • powershell
  • routeros
  • livescript (10.4.0 and 9.18.5 included this fix)
  • javascript & typescript (10.4.0 included partial fixes)

And of course any aliases of those languages have the same issue. ie: hpp is no safer than cpp.

Grammars with polynomial backtracking issues:

  • kotlin
  • gcode
  • d
  • aspectj
  • moonscript
  • coffeescript/livescript
  • csharp
  • scilab
  • crystal
  • elixir
  • basic
  • ebnf
  • ruby
  • fortran/irpf90
  • livecodeserver
  • yaml
  • x86asm
  • dsconfig
  • markdown
  • ruleslanguage
  • xquery
  • sqf

And again: any aliases of those languages have the same issue. ie: ruby and rb share the same ruby issues.

Patches

  • Version 10.4.1 resolves these vulnerabilities. Please upgrade.

Workarounds / Mitigations

  • Discontinue use the affected grammars. (or perhaps use only those with poly vs exponential issues)
  • Attempt cherry-picking the grammar fixes into older versions...
  • Attempt using newer CDN versions of any affected languages. (ie using an older CDN version of the library with newer CDN grammars). Your mileage may vary.

References

For more information

If you have any questions or comments about this advisory:

CVE-2020-26237

Impact

Affected versions of this package are vulnerable to Prototype Pollution. A malicious HTML code block can be crafted that will result in prototype pollution of the base object's prototype during highlighting. If you allow users to insert custom HTML code blocks into your page/app via parsing Markdown code blocks (or similar) and do not filter the language names the user can provide you may be vulnerable.

The pollution should just be harmless data but this can cause problems for applications not expecting these properties to exist and can result in strange behavior or application crashes, i.e. a potential DOS vector.

If your website or application does not render user provided data it should be unaffected.

Patches

Versions 9.18.2 and 10.1.2 and newer include fixes for this vulnerability. If you are using version 7 or 8 you are encouraged to upgrade to a newer release.

Workarounds

Patch your library

Manually patch your library to create null objects for both languages and aliases:

const HLJS = function(hljs) {
  // ...
  var languages = Object.create(null);
  var aliases = Object.create(null);

Filter out bad data from end users

Filter the language names that users are allowed to inject into your HTML to guarantee they are valid.

References

For more information

If you have any questions or comments about this advisory:


Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by Mend Renovate. View repository job log here.

@renovate
Copy link
Author

renovate bot commented Jun 18, 2022

⚠ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: package-lock.json
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated @evocateur/pacote@9.6.5: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @evocateur/npm-registry-fetch@4.0.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated read-package-tree@5.3.1: The functionality that this package provided is now in @npmcli/arborist
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
npm WARN deprecated @evocateur/libnpmaccess@3.1.2: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @evocateur/libnpmpublish@1.2.2: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN @octokit/plugin-request-log@1.0.4 requires a peer of @octokit/core@>=3 but none is installed. You must install peer dependencies yourself.

ERR! lerna Unknown command "info"
ERR! lerna Did you mean init?
npm WARN deprecated highlight.js@9.18.2: this package has been deprecated; has build issues;
npm WARN deprecated highlight.js@10.1.2: Potential vulnerability. Please upgrade to @latest
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN @storybook/core@6.1.0 requires a peer of react-dom@^16.8.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @storybook/components@6.1.0 requires a peer of react-dom@^16.8.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @storybook/react@6.1.0 requires a peer of @babel/core@^7.11.5 but none is installed. You must install peer dependencies yourself.
npm WARN @storybook/react@6.1.0 requires a peer of react-dom@^16.8.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @storybook/ui@6.1.0 requires a peer of react-dom@^16.8.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @storybook/components@6.1.0 requires a peer of react-dom@^16.8.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN downshift@6.1.7 requires a peer of react@>=16.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-ssr-advanced-seed@1.0.7 No repository field.

lerna notice cli v3.18.4
lerna info versioning independent
lerna notice filter excluding "__tests__"
lerna info filter [ '!__tests__' ]
lerna info Bootstrapping 27 packages
lerna info Installing external dependencies
lerna ERR! npm install --ignore-scripts --no-package-lock --ignore-scripts --no-audit --package-lock-only exited 1 in 'omega-web'
lerna ERR! npm install --ignore-scripts --no-package-lock --ignore-scripts --no-audit --package-lock-only stderr:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: omega-web@0.3.11
npm ERR! Found: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.0" from @material-ui/core@4.4.2
npm ERR!   node_modules/@material-ui/core
npm ERR!     @material-ui/core@"4.4.2" from the root project
npm ERR!     peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.4.1
npm ERR!     node_modules/@material-ui/icons
npm ERR!       @material-ui/icons@"4.4.1" from the root project
npm ERR!   peer react@"^16.0.0" from react-dom@16.8.6
npm ERR!   node_modules/react-dom
npm ERR!     react-dom@"16.8.6" from the root project
npm ERR!     peer react-dom@"^16.8.0" from @material-ui/core@4.4.2
npm ERR!     node_modules/@material-ui/core
npm ERR!       @material-ui/core@"4.4.2" from the root project
npm ERR!       1 more (@material-ui/icons)
npm ERR!     2 more (@material-ui/icons, @material-ui/styles)
npm ERR!   2 more (@material-ui/icons, @material-ui/styles)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! react-fade-in@"0.1.6" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@15.7.0
npm ERR! node_modules/react
npm ERR!   peer react@"^15.4.1" from react-fade-in@0.1.6
npm ERR!   node_modules/react-fade-in
npm ERR!     react-fade-in@"0.1.6" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /tmp/renovate-cache/others/npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/renovate-cache/others/npm/_logs/2022-06-18T21_46_37_872Z-debug-0.log

lerna ERR! npm install --ignore-scripts --no-package-lock --ignore-scripts --no-audit --package-lock-only exited 1 in 'omega-web'

@guardrails
Copy link

guardrails bot commented Jun 18, 2022

⚠️ We detected 35 security issues in this pull request:

Vulnerable Libraries (35)
Severity Details
High @lerna/add@3.18.4 (t) upgrade to: >3.21.0
High @lerna/bootstrap@3.18.4 (t) upgrade to: >3.21.0
High @lerna/changed@3.18.4 (t) upgrade to: >3.21.0
High @lerna/clean@3.18.4 (t) upgrade to: >3.21.0
High @lerna/diff@3.18.0 (t) upgrade to: >3.21.0
High @lerna/exec@3.18.4 (t) upgrade to: >3.21.0
High @lerna/import@3.18.0 (t) upgrade to: >3.22.0
High @lerna/init@3.18.0 (t) upgrade to: >3.21.0
High @lerna/link@3.18.0 (t) upgrade to: >3.21.0
High @lerna/list@3.18.4 (t) upgrade to: >3.21.0
High @lerna/publish@3.18.4 (t) upgrade to: >3.22.1
High @lerna/run@3.18.4 (t) upgrade to: >3.21.0
High @lerna/version@3.18.4 (t) upgrade to: >3.22.1
High @pm2/agent@1.0.4 (t) upgrade to: >2.0.0
High @pm2/js-api@0.6.0 (t) upgrade to: >0.6.1
High @storybook/react@6.1.0 upgrade to: >=6.5.9
High cheerio@1.0.0-rc.3 (t) upgrade to: >1.0.0-rc.3
High dns-packet@1.3.1 (t) upgrade to: >=1.3.2
Medium elliptic@6.5.3 (t) upgrade to: >=6.5.4
Critical eventsource@1.0.7 (t) upgrade to: >=1.1.1
Critical handlebars@4.7.6 (t) upgrade to: >=4.7.7
Medium hosted-git-info@2.8.5 (t) upgrade to: >=2.8.9
Critical jsprim@1.4.1 (t) upgrade to: >1.4.1 || >2.0.1
Medium jszip@3.2.2 (t) upgrade to: >=3.7.0
Medium lowlight@1.14.0 (t) upgrade to: >1.16.0
Critical merge-deep@3.0.2 (t) upgrade to: >=3.0.3
High moment@2.24.0 (t) upgrade to: >=2.29.2
Medium node-notifier@8.0.0 (t) upgrade to: >=8.0.1
Medium path-parse@1.0.6 (t) upgrade to: >=1.0.7
Medium refractor@2.10.1 (t) upgrade to: >3.4.0 || >4.1.1
High renderkid@2.0.3 (t) upgrade to: >2.0.5
High systeminformation@4.27.3 (t) upgrade to: >5.6.3
High tmpl@1.0.4 (t) upgrade to: >=1.0.5
Medium trim-off-newlines@1.0.1 (t) upgrade to: >=1.0.3
Critical url-parse@1.4.7 (t) upgrade to: >1.5.8

More info on how to fix Vulnerable Libraries in JavaScript.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

@renovate renovate bot changed the title chore(deps): update dependency highlight.js [security] chore(deps): update dependency highlight.js [security] - autoclosed Mar 24, 2023
@renovate renovate bot closed this Mar 24, 2023
@renovate renovate bot deleted the renovate/npm-highlight.js-vulnerability branch March 24, 2023 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

0 participants