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

[Bug]: Audit failures from lodash imports #2954

jcollum opened this issue Oct 7, 2021 · 1 comment · Fixed by #2959

[Bug]: Audit failures from lodash imports #2954

jcollum opened this issue Oct 7, 2021 · 1 comment · Fixed by #2959


Copy link

@jcollum jcollum commented Oct 7, 2021



Steps to reproduce

Use Jest@latest (27.2.4 today).

Run npm audit, see audit failures related to lodash (this is from better-npm-audit):

║                                                      === npm audit security report ===                                                       ║
║                                                                                                                                              ║
║ ID      │ Module │ Title                              │ Paths           │ Sev.     │ URL                                               │ Ex. ║
║ 1002373 │ lodash │ Arbitrary code execution in lodash │ lodash          │ critical │ │ n   ║

But when you look at the advisory it's an edge case: it's a vulnerability that is only present when you take user input and put it into a template. NPM's audit is very paranoid and that's OK. Better to get notified about all potential failures IMO.

Then I run a why and get a lot of output similar to this:

              jest-cli@"^27.2.4" from jest@27.2.4
                dev jest@"^27.2.4" from the root project
                peer jest@"^27.0.0" from ts-jest@27.0.5
                  dev ts-jest@"^27.0.5" from the root project

So the conclusion seems to be that ts-jest is importing too much of Lodash.

Expected behavior

I'd like ts-jest to not result in audit failures.

Actual behavior

I'm getting audit failures.

Debug log

I don't think this is relevant here.

Additional context

We solve this by importing the mini-packages like lodash.range. It looks this is feasible here as well.

I'm open to making a PR for this if the team is willing to consider this change.


    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node
    npm: 7.22.0 - ~/.nvm/versions/node/v14.17.6/bin/npm
    jest: ^27.2.4 => 27.2.4
@jcollum jcollum changed the title [Bug]: Snyk failures from lodash imports [Bug]: Audit failures from lodash imports Oct 7, 2021
Copy link

@ahnpnl ahnpnl commented Oct 8, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants