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

Silence audit and funding messages from npm #1301

Merged
merged 1 commit into from
Sep 4, 2024
Merged

Conversation

jeffwidman
Copy link
Member

While reviewing some logs, I noticed the following:

added 1 package, changed 30 packages, and audited 382 packages in 6s

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

found 0 vulnerabilities

While I'm not against security, nor supporting OSS maintainers (I co-maintain 10+ projects myself!), I am against noisy logs that add no value.

So let's silence these:

  1. When they appear in CI, they add no value.
  2. We've got our own security tools for vulnerable deps, which we rely on instead of npm audit results.
  3. When I'm skimming logs looking for debug information, these just get in my way.
  4. There may be a speed boost if the audit/fix metadata requires an additional API call, and silencing actually skips that rather than merely silencing it.

There's multiple ways to silence these: https://benjamincrozat.com/disable-packages-are-looking-for-funding

Originally I tackled this by adding --no-audit --no-fund flags, but there's a lot of different entrypoints and workflows that call npm ci or npm install. Even if I do manage to get them all, there's always a risk someone will come along later and add another entrypoint. So that's why I went the .npmrc route.

After this change, the logs are much better:

added 1 package, changed 30 packages, and audited 382 packages in 6s

While reviewing some logs, I noticed the following:
```shell
added 1 package, changed 30 packages, and audited 382 packages in 6s

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

found 0 vulnerabilities
```

While I'm not against security, nor supporting OSS maintainers (I
co-maintain 10+ projects myself!), I am against noisy logs that add no
value.

So let's silence these:

1. When they appear in CI, they add no value.
1. We've got our own security tools for vulnerable deps, which we rely
   on instead of `npm audit` results.
1. When I'm skimming logs looking for debug information, these just get
   in my way.
1. There may be a speed boost if the audit/fix metadata requires an additional API call, 
   and silencing actually skips that rather than merely silencing it.

There's multiple ways to silence these: https://benjamincrozat.com/disable-packages-are-looking-for-funding

Originally I tackled this by adding `--no-audit --no-fund` flags, but
there's a lot of different entrypoints and workflows that call `npm ci`
or `npm install`. Even if I do manage to get them all, there's always a
risk someone will come along later and add another entrypoint. So that's
why I went the `.npmrc` route.

After this change, the logs are much better:
```shell
added 1 package, changed 30 packages, and audited 382 packages in 6s
```
@jeffwidman jeffwidman merged commit d472c0c into main Sep 4, 2024
9 checks passed
@jeffwidman jeffwidman deleted the jeffwidman-patch-1 branch September 4, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants