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

Replace cheerio? #1801

Closed
honzajavorek opened this issue Aug 31, 2018 · 8 comments
Closed

Replace cheerio? #1801

honzajavorek opened this issue Aug 31, 2018 · 8 comments

Comments

@honzajavorek
Copy link

Is your feature request related to a problem? Please describe.

We're doing legal and security audits of our dependencies and so far one of the most problematic parts is the cheerio project and its dependencies. See following issues:

In many cases, there is no response from @fb55 for a long time and the issues are quite important as technically, legally, nobody should be really using packages distributed without explicit license. A code without license is to be considered proprietary by default and using such code could be easily classified as theft. This makes it problematic to use enzyme in any company or by any individual who actually cares about licensing.

Moreover, the cheerio project seems to be more or less abandoned:

image

It seems to me @fb55's dependencies and the cheerio project act as a single point of failure in such a successful project as enzyme is. Even if you don't care about licensing, it's apparently naive to expect the dependencies will ever get updated, bugs fixed, etc.

Describe the solution you'd like / Describe alternatives you've considered

Well it doesn't look like whacko was successful in forking cheerio, as it's no longer maintained either. I'm really not sure what are the alternatives here, at least among forks I can't see anything in better condition. And even whacko is still using the css-select library, which is the biggest offender here 😢

@honzajavorek
Copy link
Author

What about using the jQuery npm package itself, directly?

@ljharb
Copy link
Member

ljharb commented Aug 31, 2018

@honzajavorek the jQuery npm package requires a DOM to work; the whole point of cheerio is that it doesn't.

Since enzyme is a test framework, there shouldn't be any security issue, and since you're not redistributing it, there's unlikely to be any legal issue - with any of its dependencies. Specifically, while the lack of a proper SPDX identifier and/or a license file in a given dep is frustrating, it doesn't necessarily invalidate the intended license - it just delegates that decision to a court in the exceedingly unlikely event of a lawsuit, which would weigh the intent of the author.

Cheerio got a v1 release in 2017; that activity has slowed is not the same as "abandoned".

I'm not interested in replacing cheerio with anything else; we'd get rid of render entirely before doing so.

Re "no response", have you tried emailing them, or reaching out on twitter, or contacting their employer? I've successfully done all of those to get ahold of people that perhaps don't look at their github notifications and/or disable the notification emails.

@honzajavorek
Copy link
Author

Since enzyme is a test framework, there shouldn't be any security issue

Not so important for this issue, but... A test framework is a program which the developer runs on their computer. Developer's computer is usually full of environment variables filled with access tokens, private keys, etc. Company's developer is often the best attack vector.

since you're not redistributing it

In my company lawyers' understanding of the world, if I'm building an Open Source product, then both its dependencies and the first level of dev dependencies are considered to be distribution.

court

Regarding court, I could repeat this comment airbnb/js-shims#8 (comment)


I totally understand if replacing Cheerio is not a viable solution. I couldn't easily find a good replacement myself and there possibly even isn't any. I wanted to check first though - I couldn't know, sometimes projects consider transition to different solutions they're themselves aware of, and in that case I would learn by this issue and I could help with contributions to make it happen.

I filed issues, PRs, I mentioned @fb55 multiple times, I couldn't find his Twitter, and I wrote an email. I checked all his repositories and they seem to be really abandoned to me, unlike Cheerio, which seems to be at least somewhat pulsating, as you pointed out. I guess I'm left with removing Enzyme from our stack and/or with waiting.

I may try to contact his employers, but that feels a bit creepy to me. He, as an author of Open Source, has a full right to not to care, and I want to respect that. But in that case, the projects up the dependency chain should/could care and compensate. I admit it's really hard in this particular case.

@ljharb
Copy link
Member

ljharb commented Aug 31, 2018

Dev deps count in terms of use, but transitive deps that you don’t distribute aren’t your concern. Obviously you have to respect what your lawyers tell you, but “some lawyers said so” isn’t the same thing as actual legal obligation.

@honzajavorek
Copy link
Author

honzajavorek commented Aug 31, 2018 via email

@ljharb
Copy link
Member

ljharb commented Aug 31, 2018

It's not linked at all, it doesn't ship with enzyme - you install it. and if you don't distribute it, even if it's unlicensed, you may still have the right to use it - that's the grey area.

@honzajavorek
Copy link
Author

honzajavorek commented Sep 1, 2018 via email

@ljharb
Copy link
Member

ljharb commented Sep 1, 2018

npm install is pulling them down. You're not distributing them - you're only distributing a package name and a version number. Using npm means no linking - linking is a compiler step, there's no "dynamic linking". That article clearly matches my definition of "distribution".

I am in constant communication with my company's lawyers, which is why I'm confident in this interpretation.

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

No branches or pull requests

2 participants