balderdashy / sails

Realtime MVC Framework for Node.js
https://sailsjs.com
MIT License
22.82k stars 1.95k forks source link

NPM audit issues in Sails #7349

Open nathaniel-watson-ctg-com opened 3 days ago

nathaniel-watson-ctg-com commented 3 days ago

The latest version of sails has a variety of issues listed under NPM audit.

The 7 vulnerabilities come from 3 out-of-date packages, 1 of which is introduced via Express.

For context, I found this by creating a new project and running "npm init" followed by "npm install sails", to ensure no other packages were contaminating the results. To make things easier, the commands I ran and their output are specified at the bottom of this ticket.

I'm not using Grunt or any of the database adapters, so I've listed those as non-applicable below.


Node version: v18.14.0

Sails version (sails): 1.5.11

ORM hook version (sails-hook-orm): N/A ?

Sockets hook version (sails-hook-sockets): N/A

Organics hook version (sails-hook-organics): N/A

Grunt hook version (sails-hook-grunt): N/A

Uploads hook version (sails-hook-uploads): N/A

DB adapter & version (e.g. sails-mysql@5.55.5): N/A

Skipper adapter & version (e.g. skipper-s3@5.55.5): N/A


D:\temp>mkdir sailsTest

D:\temp>cd sailsTest

D:\temp\sailsTest>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (sailstest)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to D:\temp\sailsTest\package.json:

{
  "name": "sailstest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Is this OK? (yes)

D:\temp\sailsTest>npm install sails
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm WARN deprecated glob@7.1.2: Glob versions prior to v9 are no longer supported

added 248 packages, and audited 249 packages in 20s

17 packages are looking for funding
  run `npm fund` for details

7 vulnerabilities (2 moderate, 5 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

D:\temp\sailsTest>npm audit
# npm audit report

body-parser  <1.20.3
Severity: high
body-parser vulnerable to denial of service when url encoding is enabled - https://github.com/advisories/GHSA-qwcr-r2fm-qrc7
fix available via `npm audit fix --force`
Will install sails@0.12.14, which is a breaking change
node_modules/body-parser
  express  <=4.19.2 || 5.0.0-alpha.1 - 5.0.0-beta.3
  Depends on vulnerable versions of body-parser
  Depends on vulnerable versions of path-to-regexp
  Depends on vulnerable versions of send
  Depends on vulnerable versions of serve-static
  node_modules/express
    sails  *
    Depends on vulnerable versions of express
    Depends on vulnerable versions of path-to-regexp
    Depends on vulnerable versions of router
    Depends on vulnerable versions of serve-static
    node_modules/sails

path-to-regexp  <=0.1.9 || 0.2.0 - 1.8.0
Severity: high
path-to-regexp outputs backtracking regular expressions - https://github.com/advisories/GHSA-9wv6-86v2-598j
path-to-regexp outputs backtracking regular expressions - https://github.com/advisories/GHSA-9wv6-86v2-598j
fix available via `npm audit fix --force`
Will install sails@0.12.14, which is a breaking change
node_modules/express/node_modules/path-to-regexp
node_modules/path-to-regexp
node_modules/router/node_modules/path-to-regexp
  router  1.0.0-beta.1 - 2.0.0-beta.2
  Depends on vulnerable versions of path-to-regexp
  node_modules/router

send  <0.19.0
Severity: moderate
send vulnerable to template injection that can lead to XSS - https://github.com/advisories/GHSA-m6fv-jmcg-4jfg
fix available via `npm audit fix --force`
Will install sails@0.12.14, which is a breaking change
node_modules/send
node_modules/serve-static/node_modules/send
  serve-static  <=1.16.0
  Depends on vulnerable versions of send
  node_modules/express/node_modules/serve-static
  node_modules/serve-static

7 vulnerabilities (2 moderate, 5 high)

To address all issues (including breaking changes), run:
  npm audit fix --force

D:\temp\sailsTest>notepad.exe package.json

D:\temp\sailsTest>node --version
v18.14.0

D:\temp\sailsTest>
sailsbot commented 3 days ago

@nathaniel-watson-ctg-com Thanks for posting! We'll take a look as soon as possible.

In the mean time, there are a few ways you can help speed things along:

Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.

For help with questions about Sails, click here.

nathaniel-watson-ctg-com commented 3 days ago

According to the NPM audit results, there is an updated version of send available, so that one should be fixable.

Version 4.21.0 of express seems to fix the body-parser bug.

The newest version of path-to-regexp is 8.1.0. That should fix the vulnerability, but it'll be a big jump.

I'm not sure what to do about the deprecation warnings.

senpai-notices commented 2 days ago

7347 and #7348 already takes care of this.

senpai-notices commented 19 hours ago

This is now in the latest release.