前言

明天向大家举荐一款代码依赖包破绽查看maven插件--dependency-check-maven。通过这个插件能够扫描出我的项目中是否依赖曾经存在的安全漏洞包

如何应用

前置条件:该插件须要应用maven 3.1或更高版本

1、在我的项目pom引入dependency-check-maven插件 GAV
  <build>        <plugins>            <plugin>                <groupId>org.owasp</groupId>                <artifactId>dependency-check-maven</artifactId>                <version>7.0.0</version>                <configuration>                    <autoUpdate>true</autoUpdate>                </configuration>                <executions>                    <execution>                        <goals>                            <goal>check</goal>                        </goals>                    </execution>                </executions>            </plugin>        </plugins>    </build>
2、切换到我的项目的target目录,执行mvn dependency-check:check

注: 如果是idea,能够间接如下,右键运行


第一次执行的话,他的速度会挺慢的,因为他须要从NIST托管的国家破绽数据库下载破绽数据到本地备份库。

在执行的过程中,可能会呈现

Failed to initialize the RetireJS repo

解决的方法

下载jsrepository.json并将该文件放到maven私仓地址\org\owasp\dependency-check-data\7.0目录下

执行结束后,会在target目录下产生dependency-check-report.html文件

3、通过浏览器关上dependency-check-report.html


点击相应的链接信息,能够查看相应的破绽形容

总结

本文简略的介绍一下如何利用dependency-check-maven插件来查看代码依赖包安全漏洞。相干具体用法,能够查看如下链接
https://jeremylong.github.io/DependencyCheck/dependency-check-maven/index.html

demo链接

https://github.com/lyb-geek/springboot-learning/tree/master/springboot-git-commit