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

Support Yarn v4 #332

Open
mistaecko opened this issue May 15, 2024 · 6 comments
Open

Support Yarn v4 #332

mistaecko opened this issue May 15, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@mistaecko
Copy link

Running audit-ci with yarn 4.1.1 is broken, and does not report vulnerabilities at all.

It seems that v4 introduced major changes to the json output format of yarn npm audit that break audit-ci.

Example output in a project with vulnerabilities:

$ npx audit-ci
audit-ci version: 6.6.1
Yarn Berry audit report results:
undefined
undefined
[truncated]
undefined
undefined
Passed yarn security audit.

I updated one of the existing tests in test/yarn-berry-moderate to use yarn 4, and it (obviously) fails.

@quinnturner quinnturner added bug Something isn't working enhancement New feature or request labels May 16, 2024
@quinnturner
Copy link
Member

I am definitely interested in supporting this. I have some draft PRs that touch on adding test cases. I hope to release support in audit-ci v7.

@quinnturner
Copy link
Member

quinnturner commented Jun 1, 2024

After further investigation, Yarn v4 seems to support many of audit-ci's features directly: documentation on yarn npm audit.

With the recently released audit-ci v7, I decided not to support Yarn v4 out of the gate because I wanted to see feedback from the community before investing the time into supporting it.

The main functional gap in Yarn v4's implementation is that it doesn't support audit-ci's NSPRecord` feature, which allows you to set advisories' expiry.

In the meantime, I've documented that Yarn v4 is not supported in the README. Accordingly, I am removing the bug label.

If you're still interested in supporting it, let me know!

@quinnturner quinnturner removed the bug Something isn't working label Jun 1, 2024
@quinnturner quinnturner changed the title audit-ci is Incompatible with yarn version 4 Support Yarn v4 Jun 1, 2024
@quinnturner quinnturner pinned this issue Jun 1, 2024
@hwo411
Copy link

hwo411 commented Jun 3, 2024

+1 for this

@quinnturner
Copy link
Member

@hwo411 I am open to supporting it, it's not a ton of work. Have you tried using Yarn v4's native audit management with allowlists? If you have and you have found a gap that audit-ci fills well, I am interested!

@mistaecko
Copy link
Author

@quinnturner I haven't explored yarn 4's npm audit in detail yet. What immediately stood out to me though was the lack of a file-based configuration and ignore list. Of course, creating a wrapper script around the native yarn audit which provides that functionality is not a huge lift, but still something that needs to be documented, maintained, and published (or copy/pasted ugh).

audit-ci provides a nice abstraction across different package managers (and their versions). It enables a consistent mechanism to configure and manage audits in an org with a large number of repos that are - for various reasons - using different package managers and versions.

@hwo411
Copy link

hwo411 commented Jun 4, 2024

@quinnturner thanks!

It's very well explain by @mistaecko what are the downsides of the npm audit/yarn audit. I think it's quite inconvenient if you need to switch the tool if you decide to start with or migrate to yarn v4 + you need to implement missing features yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants