News for hackers. Stuff that matters.
Re:Compromised PyTorch-nightly dependency chain December 30t... by p-e-w on Saturday December 31, 2022 @11:47PM (#34203692)
Python has the best or second-best standard library in existence, Go being its only competitor for that title.

It still contains only a tiny fraction of the functionality needed by any large project. The world is just too complex for a standard library to ever realistically cover a meaningful portion of the problem space.

We all need tensor algebra, video decoding, cutting-edge network protocols, compression, cryptography, dozens of data exchange formats, syscall bindings for three or more platforms, fuzzing, containers, and I don't know what else. This isn't going to all fit into a standard library. "Dependency hell" is here to stay.

Re:Compromised PyTorch-nightly dependency chain December 30t... by TylerE on Saturday December 31, 2022 @11:58PM (#34203741)
Java?
Re:Compromised PyTorch-nightly dependency chain December 30t... by speedgoose on Sunday January 01, 2023 @12:14AM (#34203817)
Let’s start the year with a programming language debate!

In my opinion, Java’s standard library is good, but not as good as the one in Python and then Golang. I also prefer the one in C#.

Re:Compromised PyTorch-nightly dependency chain December 30t... by v3ss0n on Sunday January 01, 2023 @12:10AM (#34203799)
Log4j?
Re:Compromised PyTorch-nightly dependency chain December 30t... by fbdab103 on Sunday January 01, 2023 @12:24AM (#34203873)
Never thought I would shrill for Java, but that vulnerability could exist in any language. That it was such a widespread issue only goes to show how widely deployed Java is for server software.
Re:Compromised PyTorch-nightly dependency chain December 30t... by GrayShade on Sunday January 01, 2023 @01:26AM (#34204141)
No, it wouldn't. Java is the only ecosystem where dynamically loading code by default from random web servers is considered to be a feature. Probably a legacy of its early decade, when everybody was dreaming of this.
Re:Compromised PyTorch-nightly dependency chain December 30t... by rfoo on Sunday January 01, 2023 @02:14AM (#34204328)
Java is unique as the culture encourages doing magic convention over configuration by reflection AND it-just-works serialization, which leads to a new bug class: unsafe deserialization except that the deserialization happens in the library by default (e.g. fastjson, jackson, tons of struts2 bugs, etc) and propagates along the supply chain.

Libraries refuse to shift away from this culture thing, and decided to just blacklist the known exploit path while keeping the vulnerability intact. It's not that they do this for backward-compatibility, it's new libraries still being designed this way.

The log4j 2 bug is slightly different, but IMO as a design issue it has root in the same culture thing described above.

Re:Compromised PyTorch-nightly dependency chain December 30t... by josefx on Sunday January 01, 2023 @03:04AM (#34204565)
> Libraries refuse to shift away from this culture thing, and decided to just blacklist the known exploit path while keeping the vulnerability intact.

Log4j 2 refused to shift away from it since they are paid to add that kind of bloat, yes this wasn't an accident caused by a bad culture, this was a feature someone requested. As far as I understood they are completely separate from the original log4j and it is just another, mostly compatible logging implementation.

> Java is unique as the culture encourages doing magic convention over configuration by reflection AND it-just-works serialization

As opposed to what? Python? The language that culturally refuses to fix the GIL and as workaround provides multiprocessing, which requires that everything is serialized?

Also I may not have seen many Python code bases, but from what I have seen ClassLoader/Import abuse is alive in both languages.

Re:Compromised PyTorch-nightly dependency chain December 30t... by peteradio on Sunday January 01, 2023 @08:38AM (#34206164)
Python developers aren't smart enough to develop threaded code. Making threading work in python would be like giving crack to an infant. Python maintainers made the right choice to coddle their user base, you see if you have to be smart to use python then you wouldn't be using python to begin with and user base goes to zero. I kid I kid. Happy New Years - a python developer
Re:Compromised PyTorch-nightly dependency chain December 30t... by rfoo on Sunday January 01, 2023 @09:11AM (#34206367)
I agree that the GIL situation is unfortunate.

Python at least does not pretend their it-just-works serialization is secure. The documentation [1] actively discourages deserializing untrusted data and suggests to use pure data format (e.g. JSON) as possible.

In contrast, the documentation on ObjectInputStream before Java 11 does not warn about this at all. Even then [2], it suggests to implement blacklist/whitelist filters, and it is pretty hard to get right. The same filtering can also be done for pickle, but the usual consensus in Python developers seems to be "don't do this even if it's possible".

> but from what I have seen ClassLoader/Import abuse is alive in both languages.

Yeah, should have said that my rant is mainly against endless deserialization/OGNL injection/whatever-popular-expression-language injection bugs in frameworks, not abusing ClassLoader. These features, just like log4j2's code-execution-disguised-as-string-interpolation feature [3], shouldn't exist.

[1] https://docs.python.org/3/library/pickle.html

[2] https://docs.oracle.com/en/java/javase/11/docs/api/java.base...

[3] I'd argue that's the real bug, instead of the obvious JNDI class loader blah blah stuff. Luckily log4j didn't refuse to fix it and completely removed "message lookup".

Re:Compromised PyTorch-nightly dependency chain December 30t... by richbell on Sunday January 01, 2023 @12:17AM (#34203827)
That's a third-party dependency, not a part of the standard library.
Re:Compromised PyTorch-nightly dependency chain December 30t... by cpurdy on Sunday January 01, 2023 @12:32PM (#34208492)
Log4j was never part of Java
Re:Compromised PyTorch-nightly dependency chain December 30t... by josefx on Sunday January 01, 2023 @02:46AM (#34204473)
> This isn't going to all fit into a standard library.

There is a size limit for standard libraries?

I think Java introduced modules and its dependency model so you could package only what your software needed.

Re:Compromised PyTorch-nightly dependency chain December 30t... by TuringTest on Monday January 02, 2023 @02:36AM (#34215354)
> There is a size limit for standard libraries?

There is a size limit to what language curators are able to maintain, yes.

The idea of the standard library is that it will select components that are general enough to cover a wide range of use cases; therefore the language builders ned time to review every new proposal, and their time is limited.

You may dump everything under the sun in the standard library, but then it won't be better than what you get from a library marketplace.