# Npm audit fails

**URL:** <https://discourse.nodered.org/t/npm-audit-fails/50525>\
**Category:** General\
**Created:** [2 September 2021 04:18 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525 "2021-09-02T04:18:18Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 October 2021 14:31 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/21 "2021-10-08T14:31:01Z")

</div>

You can wait until the next version is included by node-red.

Is that issue a particular problem for you?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 October 2021 15:44 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/22 "2021-10-08T15:44:10Z")

</div>

I have just published node-red-admin@2.2.1 that updates the axios dependency.

This is one Node-RED dependency where we _don't_ pin to a specific version, so you should be able to update it.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 October 2021 16:24 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/23 "2021-10-08T16:24:49Z")

</div>

> [@knolleary](#):
>
> you should be able to update it.

Should that be?  
`sudo npm -g update node-red-admin`

It does not update, but I can't work out why. `npm -g outdated` isn't showing it either.  
npm list shows

```auto
$ npm list -g node-red-admin
/usr/lib
└─┬ node-red@2.1.0-beta.1
  └── node-red-admin@2.2.0 

```

---

<div class="post-metadata">

**Author:** ![augjoh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/augjoh/32/26464_2.png) [@augjoh](https://discourse.nodered.org/u/augjoh)\
**Post date:** [8 October 2021 16:55 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/24 "2021-10-08T16:55:11Z")

</div>

Thanks, that fixes some stuff, but there are others still open:

```auto
┌──────────────────────────────────────────────────────────────────────────────┐
│ Manual Review │
│ Some vulnerabilities require your attention to resolve │
│ │
│ Visit https://go.npm.me/audit-guide for additional guidance │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Inefficient Regular Expression Complexity in │
│ │ chalk/ansi-regex │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ ansi-regex │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=5.0.1 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ node-red │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ node-red > @node-red/editor-api > bcrypt > │
│ │ @mapbox/node-pre-gyp > npmlog > gauge > wide-align > │
│ │ string-width > strip-ansi > ansi-regex │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://github.com/advisories/GHSA-93q8-gq69-wqmw │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Inefficient Regular Expression Complexity in │
│ │ chalk/ansi-regex │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ ansi-regex │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=5.0.1 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ node-red │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ node-red > bcrypt > @mapbox/node-pre-gyp > npmlog > gauge > │
│ │ wide-align > string-width > strip-ansi > ansi-regex │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://github.com/advisories/GHSA-93q8-gq69-wqmw │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Inefficient Regular Expression Complexity in │
│ │ chalk/ansi-regex │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ ansi-regex │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=5.0.1 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ node-red │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ node-red > node-red-admin > bcrypt > @mapbox/node-pre-gyp > │
│ │ npmlog > gauge > wide-align > string-width > strip-ansi > │
│ │ ansi-regex │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://github.com/advisories/GHSA-93q8-gq69-wqmw │
└───────────────┴──────────────────────────────────────────────────────────────┘

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 October 2021 17:03 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/25 "2021-10-08T17:03:44Z")

</div>

`ansi-regex` is a dependency buried deep in the dependency tree.

It is installed due to our dependency on `bcrypt`. Given we have the latest `bcrypt` available, then it is beyond any influence of the Node-RED package.json file.

Have you tried `sudo npm -g update ansi-regex` ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 October 2021 17:37 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/26 "2021-10-08T17:37:01Z")

</div>

> [@augjoh](#):
>
> that fixes some stuff

How did you update?

---

<div class="post-metadata">

**Author:** ![augjoh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/augjoh/32/26464_2.png) [@augjoh](https://discourse.nodered.org/u/augjoh)\
**Post date:** [1 November 2021 06:09 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/27 "2021-11-01T06:09:09Z")

</div>

@knolleary I've update and getting the following output now:

```auto
║ 7950deec.712db │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
║ 7950deec.712db │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
║ 7c737c87.dad544 │ error │ Parsing error: Unexpected token transport │ function-eslint ║

```

I've tried to add the missing plugin to `nrlint` without success. How can I configure this?

The third error is triggered with the following code:

```auto
let { transport } = global.get('nodemailer');

```

What is wrong with this code?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 November 2021 08:59 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/28 "2021-11-01T08:59:08Z")

</div>

> [@augjoh](#):
>
> I've update

What exactly have you updated?

> [@augjoh](#):
>
> I've tried to add the missing plugin to `nrlint` without success.

What missing plugin? What have you done exactly?

When I run the current version of nrlint on a Function node containing the code you've shared, I get:

```auto
║ a0b5c25ababe35ba │ error │ 'transport' is assigned a value but never used. │ function-eslint ║
║ a0b5c25ababe35ba │ error │ 'global' is not defined. │ function-eslint

```

This is completely different to what you get - but it does reveal a bug in nrlint... it doesn't know about the `global` (and `flow`) builtin objects of the Function node.

So given you are getting completely different results, then we really need to know more about what you've done to get to this point.

---

<div class="post-metadata">

**Author:** ![augjoh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/augjoh/32/26464_2.png) [@augjoh](https://discourse.nodered.org/u/augjoh)\
**Post date:** [13 November 2021 10:57 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/29 "2021-11-13T10:57:35Z")

</div>

@knolleary I've update `nrlint`

```auto
$ npm ls nrlint
[...]
└── nrlint@1.0.2 

```

I'm using the following `.nrlintrc.js`:

```auto
module.exports = {
    "rules": {
        "align-to-grid": true,
        "max-flow-size": true,
        "no-duplicate-http-in-urls": true,
        "no-loops": "off",
        "no-overlapping-nodes": true,
        "no-unconnected-http-nodes": true,
        "no-unnamed-functions": true,
        "no-unnamed-links": true,
        "function-eslint": {
            "config": {
                "env": {
                    "es2021": true
                },
                "extends": "eslint:recommended",
                "parserOptions": {
                    "ecmaVersion": 12
                },
                "rules": {}
            }
        }
    },
    "extends": [
      'plugin:security/recommended'
    ],
    "plugins": [
      'eslint-plugin-security'
    ]
}

```

And getting the following results:

```auto
$ npx nrlint --debug flows.json
Flow file: /usr/home/node/.node-red/projects/node-red-ca/flows.json
Configuration file: /usr/home/node/.node-red/projects/node-red-ca/.nrlintrc.js
Loading rules from eslint-plugin-security
╔═════════════════╤══════════╤═══════════════════════════════════════════════════════════════════════╤═════════════════╗
║ Object ID │ Severity │ Message │ Rule ║
╟─────────────────┼──────────┼───────────────────────────────────────────────────────────────────────┼─────────────────╢
║ 7950deec.712db │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
║ 7950deec.712db │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
║ 49e21da1.f9db54 │ error │ Parsing error: Unexpected token fetch │ function-eslint ║
║ 7c737c87.dad544 │ error │ Parsing error: Unexpected token transport │ function-eslint ║
║ 5e402da3.a4bcd4 │ error │ Parsing error: Unexpected token dkimVerify │ function-eslint ║
║ 480f3ced.e85b04 │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
║ 480f3ced.e85b04 │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
║ 480f3ced.e85b04 │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
║ 480f3ced.e85b04 │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
║ 480f3ced.e85b04 │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
║ 480f3ced.e85b04 │ error │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint ║
╚═════════════════╧══════════╧═══════════════════════════════════════════════════════════════════════╧═════════════════╝
✖ 11 problems (11 errors, 0 warnings)

```

The two types of errors, are coming from:

```auto
/* eslint-disable security/detect-object-injection */

```

and

```auto
const { transport } = global.get('dkim-verifier')

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 January 2022 10:57 UTC](https://discourse.nodered.org/t/npm-audit-fails/50525/30 "2022-01-12T10:57:41Z")

</div>

Closed on 12 January 2022 10:57 UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/npm-audit-fails/50525.md?page=1)
