Skip to content

Docusaurus does not allow for a passing npm audit in CI/CD pipelines #5501

@mgwidmann

Description

@mgwidmann

🐛 Bug Report

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • [-] I have tried creating a repro with https://new.docusaurus.io
  • I have read the console error message carefully (if applicable)

Description

It is expected that npx @docusaurus/init@latest init my-website classic will not install dependencies with known CVE issues. However, npm audit returns vulernabilities. Even using npm audit --fix also does not allow for overriding them. Below are two examples of vulnerabilities. This prevents a project with a CI/CD pipeline (using npm audit) from using docusaurus since it will fail the build indefinitely (see the RFC on fixing this npm/rfcs#18).

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Regular Expression Denial of Service in trim                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ trim                                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.0.3                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ @docusaurus/preset-classic                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ @docusaurus/preset-classic > @docusaurus/theme-classic >     │
│               │ @mdx-js/mdx > remark-parse > trim                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1700                            │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ browserslist                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=4.16.5                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ @docusaurus/core                                             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ @docusaurus/core > react-dev-utils > browserslist            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1747                            │
└───────────────┴──────────────────────────────────────────────────────────────┘

Have you read the Contributing Guidelines on issues?

Yes. This is not a security vulnerability that is not already publicly known, this is just reporting the fact that docusaurus does not allow upgrading to remove packages with known CVEs and is therefore a bug in docusaurus's dependency tree.

Steps to reproduce

  1. mkdir docusaurus-playground
  2. cd docusaurus-playground
  3. npx @docusaurus/init@latest init my-website classic
  4. npm i --package-lock-only
  5. npm audit --prod

Expected behavior

NPM should find no vulnerabilities or npm audit --fix should fix them.

Actual behavior

found 94 vulnerabilities (68 moderate, 26 high) in 1337 scanned packages
  94 vulnerabilities require manual review. See the full report for details.

Running npm audit --fix does not allow for overriding any vulnerabilities. If a CI/CD pipeline is built with npm audit this blocks the pipeline without any way to unblock it (see discussion about this issue in the RFC npm/rfcs#18 )

Your environment

  • Public source code: N/A
  • Public site URL: N/A
  • Docusaurus version used: 2.0.0-beta.6
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): v14.17.5
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Mac OSX

Reproducible demo

See above reproduce steps to build a local environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed: please-fix-this-cveThis issue is asking for fixing a CVE in a build-only dep which doesn't pose any real threat.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions