pact-foundation / pact-js

JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
https://pact.io
Other
1.63k stars 349 forks source link

[security risk] dependency cli-color depends on es5-ext #1253

Closed Roozenboom closed 4 days ago

Roozenboom commented 4 days ago

As a big enterprise organisation we continuously scanning our dependencies for vulnerabilities and other security risks. One of the dependencies of @pact-foundation/pact is 'cli-color' (https://github.com/medikoo/cli-color), this package by itself has not security risk, but it depends on 'es5-ext' (https://github.com/medikoo/es5-ext) that is marked as malicious by sonatype (sonatype-2022-2248) as it contains malware/protestware in a postinstall script since 2022.

The question is can this be replaced by an alternative package?

There are many alternatives that can do console coloring as well, probably the best known one is chalk: https://www.npmjs.com/package/chalk (see npm trends: https://npmtrends.com/chalk-vs-cli-color) And @pact-foundation/pact only uses cli-color once to show a console error in red: https://github.com/pact-foundation/pact-js/blob/d3e24a7d5e44d14ca29f1a512c4da54c03b962c1/src/httpPact/index.ts#L210

YOU54F commented 4 days ago

Sonatypes rationale of it being unexpected to the end user is fair, as it isn't documented in the readme, and a user would have to go and read issue threads, probably after the fact.

We already use chalk in the pact-js-cli project, so I am happy with that being replaced.

https://github.com/pact-foundation/pact-js-cli/blob/8af58511517558fa3449eaa4c6dcd2177820e079/package.json#L62

would you be open to proposing a pull request?

YOU54F commented 4 days ago

Released

https://github.com/pact-foundation/pact-js/releases/tag/v13.2.0

mefellows commented 4 days ago

Thanks for the PR!