RetireJS/retire.js

GitHub: RetireJS/retire.js

检测 JavaScript 库已知漏洞的扫描器,支持生成 SBOM 并可集成到开发流程和安全测试工具中。

Stars: 4078 | Forks: 434

# Retire.js **你所依赖的,你也必须让其退役** 如今有大量的 JavaScript 库可用于 Web 和 Node.JS 应用。这极大地简化了开发,但我们需要时刻关注安全修复。“使用含有已知漏洞的组件”现在是 [OWASP Top 10](https://www.owasp.org/index.php/Top_10_2013-A9-Using_Components_with_Known_Vulnerabilities) 安全风险列表的一部分,不安全的库可能会给你的 Web 应用带来巨大的风险。Retire.js 的目标是帮助你检测使用了具有已知漏洞的 JS 库版本。 Retire.js 可以通过多种方式使用: 1. [作为命令行扫描器](https://github.com/RetireJS/retire.js/tree/master/node) 2. [作为 grunt 插件](https://github.com/bekk/grunt-retire) 3. [作为 gulp 任务](#user-content-gulp-task) 4. [作为 Chrome 扩展](https://github.com/RetireJS/retire.js/tree/master/chrome) - 在 Chrome 网上应用店中**不**是官方可用的 5. [作为 Firefox 扩展](https://github.com/RetireJS/retire.js/tree/master/firefox) - **已弃用** 如果你想维护并取消其弃用状态,请告诉我们。 6. [作为 Burp 扩展](https://github.com/h3xstream/burp-retire-js) 或 [OWASP ZAP 附加组件](https://www.zaproxy.org/docs/desktop/addons/retire.js/) ## 命令行扫描器 扫描 Web 应用或 node 应用,以查找是否使用了易受攻击的 JavaScript 库和/或 Node.JS 模块。如果你还没有安装,需要先 [安装 node/npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)。在应用程序文件夹的源代码目录中运行: ``` $ npm install -g retire $ retire ``` ## SBOM 生成 retire.js 可以生成 CycloneDX 格式的 SBOM: ``` $ retire --outputformat cyclonedx ``` 默认情况下,如果 retire.js 发现漏洞,将以代码 13 退出。可以使用 `--exitwith 0` 覆盖此设置。 ## Grunt 插件 一个 [用于运行 Retire.js 的 Grunt 任务](https://github.com/bekk/grunt-retire),可作为应用程序构建流程或其他自动化工作流的一部分。 ## Gulp 任务 一个 Gulp 任务示例,可在你的 gulpfile 中用于自动监视和扫描项目文件。你可以根据需要修改监视模式 和(可选的)Retire.js 选项。 ``` const c = require("ansi-colors"); var gulp = require("gulp"); var beeper = require("beeper"); var log = require("fancy-log"); var spawn = require("child_process").spawn; gulp.task("retire:watch", ["retire"], function (done) { // Watch all javascript files and package.json gulp.watch(["js/**/*.js", "package.json"], ["retire"]); }); gulp.task("retire", function () { // Spawn Retire.js as a child process // You can optionally add option parameters to the second argument (array) var child = spawn("retire", [], { cwd: process.cwd() }); child.stdout.setEncoding("utf8"); child.stdout.on("data", function (data) { log(data); }); child.stderr.setEncoding("utf8"); child.stderr.on("data", function (data) { log(c.red(data)); beeper(); }); }); ``` ## Chrome 和 Firefox 扩展 扫描访问过的站点以查找对不安全库的引用,并在开发者控制台中发出警告。地址栏上的图标也会指示是否加载了易受攻击的库。 ## Burp 扩展和 OWASP ZAP 附加组件 [@h3xstream](https://github.com/h3xstream) 已将 Retire.js 改编为渗透测试工具 [Burp](https://portswigger.net/burp/) 和 [OWASP ZAP](https://www.zaproxy.org) 的[插件](https://github.com/h3xstream/burp-retire-js)。 [OWASP ZAP](https://www.zaproxy.org) 团队官方支持一个 Retire.js 附加组件,该组件可通过 ZAP Marketplace 获取,并且默认包含在 ZAP 的每周发布版中:https://www.zaproxy.org/docs/desktop/addons/retire.js/ ## 捐赠 捐赠将用于资助该工具和漏洞仓库的维护。
标签:Burp Suite, CI/CD 安全, CMS安全, CycloneDX, GNU通用公共许可证, Grunt, Gulp, IP 地址批量处理, JavaScript, MITM代理, Node.js, OWASP Top 10, OWASP ZAP, Retire.js, SBOM, 云安全监控, 依赖安全, 前端安全, 子域名暴力破解, 已知漏洞, 数据可视化, 数据投毒防御, 暗色界面, 硬件无关, 组件安全, 网络安全, 自动化检测, 自定义脚本, 自定义脚本, 跌倒检测, 软件物料清单, 隐私保护, 静态分析