npm - 在 SonarQube 中使用 npm 审计报告

标签 npm sonarqube audit npm-audit

我正在开发网络应用程序。
我需要检查依赖项的安全性。

我实际上正在使用 OWASP 依赖项检查扫描我的源代码,但我认为它不是在 Web 应用程序上使用的最佳工具。
我认为 npm 审计或 yarn 审计是检查这个应用程序之王的依赖项安全性的更好工具。

使用 OWASP,我使用 OWASP SonarQube 项目将结果集成到 sonarQube 中
使用的设置示例:

sonar.dependencyCheck.reportPath=$(System.DefaultWorkingDirectory)/DependencyCheckResults/dependency-check-report.xml
sonar.dependencyCheck.htmlReportPath=$(System.DefaultWorkingDirectory)/DependencyCheckResults/dependency-check-report.html

同理,有没有办法将npm审计(或yarn审计)报告导入SonarQube?

目前我使用以下命令以 json 格式生成报告:
npm audit --json

我也知道可以使用 https://github.com/eventOneHQ/npm-audit-html 从 npm 审计中生成 HTML 报告。

所以,它只是缺少一个 SonarQube 插件来导入它或类似的东西,但我找不到它。

最佳答案

目前,这似乎不可能。然而,this npm rfc 0004指定 npm audit --owasp解决这个问题的标志。此 RFC 已被接受,但尚未实现。
也许值得一试解析 npm audit --json 的输出使用一些 sonarQube 插件,但我不知道如何执行此操作。
编辑 2021-08-09
npm rfc 是 withdrawn :

The npm cli team would be happy to land this change in case it comes from a community contribution, this withdrawn was based on the fact that this is not remotely closed to being in the roadmap of the current team.

关于npm - 在 SonarQube 中使用 npm 审计报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57926484/

相关文章:

sql - 如何使用 PostgreSql 触发器和过程来审计/恢复父子表

spring-data - 如何使用 java config 配置审计

node.js - 我们可以通过 NPM 安装 Redis 吗?

javascript - 如何发布 angular2 指令

node.js - npm package.json 操作系统特定脚本

java - SonarQube 忽略 @SuppressWarnings ("all") 命令

typescript - 明确类型的更改需要多长时间才能出现在 npm @types 中?

maven - Sonar Maven 插件 : How to use project-relative paths in inclusion patterns?

java - SONAR 实现是否将伴随类视为公共(public)类的一部分 - 指标

特定表的 Oracle 11g 审计跟踪