-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Bug]: Testcontainers uses outdated versions of Snakeyaml & Jackson, which have critical vulnerabilities, flagging testcontainers on security scanning tools #9289
Comments
I can see that the latest versions of snakeyaml do not have any vulnerabilities(https://mvnrepository.com/artifact/org.yaml/snakeyaml). Is upgrading to the latest version the only expectation? Then, I can create a pull request to upgrade it. |
Yes version 2.0 and above remediate it, upgrading to 2.2 would work |
Please, do not open a PR for this. We should take into account when update a dependency to a major version when doing patch and minor releases. |
Any updates on the status of this vulnerability? It is causing some concerns for us. |
Also for us, Nexus IQ/Sonatype is blocking this |
CVE-2022-1471 SnakeYaml's Constructor() class does not restrict types which can be instantiated during deserialization. Deserializing yaml content provided by an attacker can lead to remote code execution. We recommend using SnakeYaml's SafeConsturctor when parsing untrusted content to restrict deserialization. We recommend upgrading to version 2.0 and beyond. |
This is yet another false positive. The issue is very explicit about the untrusted source. Testcontainers use YAML as configuration from the classpath (not downloading it from some external URL without any control for the YAML provider). Disclosure: in version 2, SnakeYAML's Constructor() class ALSO does not resctrict instantiation of arbitrary classes, but the tooling does not complain :-/ |
I have started the migration, but the tests in the main branch failed:
I do not want to make a PR without all the tests green. Can you please help me? |
Don't forget the other false positive -- test containers is only properly used in testing, so even if it were exploitable it would have trivial impact. Unfortunately, though, tools like sonatype only have the intelligence to assess presence of a vulnerable version, not if it is exploitable, or even used in the code. It's doubly annoying when a large enterprise has risk managers who have 0 care about exploitability and just want green charts, but have the power to block releases or even the dependency existing in the company's ecosystem because the chart isn't green. However, that's something many developers at enterprises deal with daily :( |
@ZachChuba I wonder why the developers tolerate these low quality tooling which create a stream of false positives. |
@asomov I truly understand your point. Sadly, being considered as dangerous, nearly all testcontainers releases are considered as "security critical" and quarantined by Nexus dependency proxy. As a result, we can not use it at all, except very old releases. I wonder whether having a testcontainer artefact without any dependency shaded in it (No Jackson, no SnakeYaml) could be a workaround. In our case most SnakeYaml releases are considered as "security critical" but very few are quarantined (don't ask me why). Same for Jackson, some releases are marked as "security critical" but none of them is quarantined. In the end the best solution could be to have a "slim" testcontainers Jar and let users manage their dependency hell by their own. |
@gquintana what is "Nexus dependency proxy"? Is is your corporate component? |
@asomov I perfectly know the value of testcontainers, this why I am trying to find a solution to be able to use it. I won't argue about the quality of the Sonatype tool used to prevent developers from downloading "unsecure" dependencies. With cyber security related topics it's usually very hard to argue, most of the time we can just deal with it. The Log4Shell issue brought dependencies management under the light. |
@gquintana well, if the quality of the tooling is known to be low, then the complain should be somewhat different. |
Sonatype is a useful tool for identifying the potentiality of vulnerabilities in a project, but it is horrible because enterprises typically equate the potentiality of a vulnerability with the exploitability of one. And even if proven non-exploitable sonatype might still not allow it in the software ecosystem. Yes, we developers have complaints about the tooling, but the tooling doesn't claim to assess exploitability. It essentially just scans the dependencies list and shaded classpath, takes a hash of every file and searches their database to see if that version of the file is associated with a CVE or sonatype cataloged exploit and then generates a report based on the presence. Sonatype will never mark this as a false positive because a vulnerable class file is in the classpath which is the extent of their guarantees - regardless of if that class file is actually used anywhere. As @gquintana said, this is usually pretty easy to "just deal with" instead of arguing when the dependencies are not shaded in. Problem is when it's shaded in and there's dependency clashes that make upgrades more difficult and require changing source code. I have forked testcontainers and created a version without these sonatype complaints which serves my specific purposes for the containers my team uses, but it does not pass tests for some containers so I'm not going to be able to raise a PR for it. |
@ZachChuba for your information - they do not scan any hashes, they simply check the version. Very primitive. |
@ZachChuba can you please amend the title of this issue? It is confusing, it looks like a bug and it mentions Vulnerable Dependency |
Module
Core
Testcontainers version
1.20.1
Using the latest Testcontainers version?
Yes
Host OS
MacOS
Host Arch
ARM
Docker version
What happened?
The testcontainers core shades snakeyaml 1.33 into the jar. Snakeyaml 1.33 is vulnerable to CVE-2022-1471. Even though the code does not appear vulnerable to this issue because it uses SafeConstructor, enterprises may blacklist testcontainers for the mere presence of snakeyaml 1.33. Please consider upgrading to snakeyaml 2.0 or higher.
Relevant log output
No response
Additional Information
https://nvd.nist.gov/vuln/detail/CVE-2022-1471
The text was updated successfully, but these errors were encountered: