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

Add a flag to ignore devDependencies when running yarn audit #6632

Closed
sam-warren-finnair opened this issue Nov 5, 2018 · 7 comments · Fixed by #6724
Closed

Add a flag to ignore devDependencies when running yarn audit #6632

sam-warren-finnair opened this issue Nov 5, 2018 · 7 comments · Fixed by #6724
Assignees

Comments

@sam-warren-finnair
Copy link

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

When running yarn audit dev dependencies are included in the check.

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

Add a flag to ignore dev dependencies when running the audit. This has also been reported on npm/npm#20564.

Perhaps the --production flag could be used for this?

Please mention your node.js, yarn and operating system version.

Mac: 10.14 (18A391)
Node: v8.11.3
Yarn: 1.12.1

@tommilligan
Copy link
Contributor

tommilligan commented Nov 27, 2018

As mentioned in the npm issue, using the --production flag would be a backwards incompatible change for yarn install - it would hide vulnerabilities that currently error during install.

I've submitted a PR that adds a --groups flag to yarn audit, with the currently scanned groups being the default option. If someone has a better idea for an API I'm happy to implement it.

@wavebeem
Copy link

When running yarn audit dev dependencies are included in the check.

I'm incredibly confused by this—when I was testing differences between yarn audit and npm audit, this was the only major difference I saw. npm checked devDependencies, whereas yarn does NOT. I checked and there are transitive dev dependencies in my example project with vulnerabilities that only npm finds, not yarn.

@lneves12
Copy link

@wavebeem the same happened to me. Yarn by default is only detecting vulnerabilities on the dependencies and not devDependencies. Did you find a way to detect it on both?

@lneves12
Copy link

@wavebeem It seems that using workspaces it only audits the dependencies and not devDependencies

@wavebeem
Copy link

I did not find a way to change the behavior. We switched back to npm at work anyway.

@robertlagrant
Copy link

We're also seeing yarn audit pick up a security vulnerability in a 5 levels deep dependency of a devDependency, so it seems to do this at least under some circumstances.

@lneves12
Copy link

@robertlagrant it seems that if you have a single workspace project it audits all the dependencies but if it's a multi workspaces project it doesn't audit the dev dependencies. I opened an issue for that: #7047

rally25rs pushed a commit that referenced this issue Mar 16, 2019
**Summary**

Closes #6632.

Currently `yarn audit` shows vulnerabilities for production, development and optional dependencies. It would be useful to only audit production dependencies, or select which groups of dependencies to audit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants