Skip to content

Re-evaluate icecave dependency #753

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

Closed
W0rma opened this issue Sep 20, 2024 · 8 comments · Fixed by #803
Closed

Re-evaluate icecave dependency #753

W0rma opened this issue Sep 20, 2024 · 8 comments · Fixed by #803
Labels

Comments

@W0rma
Copy link
Contributor

W0rma commented Sep 20, 2024

#518 added the dependency to icecave/parity.

In composer/composer#12039 (comment) it was recommended to check whether this dependency is really necessary:

At some point we maybe should (re-) evaluate them. Especially the icecave/* seems the odd one out as it is advertised as a A customizable deep comparison library. Which seems unneeded at a quick glance.

I just created this issue to not forget about this evaluation.

@DannyvdSluijs
Copy link
Collaborator

Thanks for issue report. Is this something you've already did some investigation into or have some knowledge about?
Or is it purely a reminder at this point?

@W0rma
Copy link
Contributor Author

W0rma commented Sep 23, 2024

It's purely a reminder.
I haven't done any research yet.

@erayd
Copy link
Contributor

erayd commented Sep 23, 2024

@W0rma The dependency on icecave/parity was added in order to fix an issue with deep comparison of objects in the enum & const constraint validation. PHP did not at the time have a native mechanism to do it properly (is that still the case?)

An alternative to the dependency would be to implement proper deep comparison in this library.

@petski
Copy link

petski commented Nov 26, 2024

justinrainbow/json-schema 6.0.0 requires icecave/parity (1.0.0) 
icecave/parity 1.0.0 requires icecave/repr (~1) 

Both icecave/* dependencies were released 10+ years ago. I found out that icecave/repr even has a file on board (see ./vendor/icecave/repr/src/Generator.php:229) that isn't parsable since PHP 8.0. A fix is already present in icecave/repr@9ccbaec (5 years ago) though...

PHPUnit has a (very) good way of comparing "things", and PHPUnit's author has released the compare component under https://github.com/sebastianbergmann/comparator. It may be a good candidate to swap out icecave/* for sebastianbergmann/comparator (?)

@umulmrum
Copy link

Sorry for the mere "I agree" comment, but at least I'd like to stress out the security perspective here. Adding a rather unknown and unmaintained library, that adds a transitive dependency that is also unknown and unmaintained, could be interpreted as one step in a supply chain attack. So I'd also be grateful if you could reconsider. Thanks very much!

(please note that this isn't about any concrete mistrust on you or the library authors, more about the general "I have to do with security, so I developed a solid level of paranoia")

@DannyvdSluijs
Copy link
Collaborator

@erayd , @W0rma and @umulmrum I'm curious, how do you see replacing the icecave dependency for the sebastian/comparator one. Are you concerns about a new dependency or about the icecave dependency?

PHP version constraints of this library would put us on the 3.0.5 version of sebastian/comparator which is from September 2022

@umulmrum
Copy link

@DannyvdSluijs From my point of view it's only about the icecave dependency, not about dependencies in general. Using sebastian/comparator in an old version isn't ideal, but at least Sebastian Bergmann is well-known and trustworthy, and there haven't been security issues in his extremely widespread libs for years. I think he pushes new PHP versions a bit too fast, but if you think your users can handle it, it would be possible to follow that fast-track and remove support for older PHP versions. Other than that I'm not familiar with either lib, sorry. I also can't assess if it is feasible to rebuild the required functionality in this lib.

What's also concerning about the icecave lib is the apparent circumstance of its inclusion. The commit was merged in 2018 but was only included in a new version 6 years later even though there were multiple releases in the meantime. If I planned to build a supply-chain attack, I might also try to make it look like my malicious code was "always there". Again, please take it as general paranoia and not a personal attack.

But this also leads to the question why the change wasn't included earlier from a functional perspective. Was it simply a long-standing issue and people are relieved it's finally solved? Or is it no longer needed?

Thank you for your work!

@DannyvdSluijs
Copy link
Collaborator

I've drafted #803 which could use some review.

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

Successfully merging a pull request may close this issue.

5 participants