I created a Spring Boot project with start.spring and I added a Spring Boot Starter JDBC to it. Unfortunately, in this piece of code appears a yellow (Intellij) error.
Here is the "bad" code:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>3.1.3</version>
</dependency>
Here is the error:
Provides transitive vulnerable dependency org.yaml:snakeyaml:1.33 CVE-2022-41854 6.5 Out-of-bounds Write vulnerability with medium severity found CVE-2022-1471 9.8 Deserialization of Untrusted Data vulnerability with high severity found Results powered by Checkmarx(c)
You know what is this? Why this error appears in an empty Spring Boot project?
This is happening due to versioning issues of spring jdbc version 3.1.3 with snakeyaml version.
You need to add a dependency to SnakeYAML 1.33 in your project. That version should then take precedence over Spring Boot's transitive dependency.
However, SnakeYAML 1.33 still has a vulnerability. You can use 2.2 in that case.
If neither of them work, you can simply exclude snakeyaml from the dependencies list as:
corresponding to the above mentioned depenedency for spring-boot-starter-jdbc
Hope this helps.