JamieMagee/vulnerability-git-hooks

GitHub: JamieMagee/vulnerability-git-hooks

一组基于 deps.dev API 的 Git pre-commit 钩子,在本地提交阶段自动检测并阻止包含已知漏洞的依赖项进入代码仓库。

Stars: 3 | Forks: 0

# 漏洞 Git Hooks [![MIT License](https://img.shields.io/github/license/JamieMagee/vulnerability-git-hooks?style=for-the-badge)](https://github.com/JamieMagee/vulnerability-git-hooks/blob/main/LICENSE.md) ![Stability Experimental](https://img.shields.io/badge/stability-experimental-orange.svg?style=for-the-badge) 一组 [git hooks][1],它们使用 [`deps.dev` query API][2] 来防止将存在漏洞的依赖项添加到您的仓库中。 ## 它是如何工作的? `pre-commit` 脚本会为每个已暂存待提交的唯一文件内容计算哈希值。 例如,`/m56MsEiiIS5aRp0T5U6VdDdjq0=` 就是 `org.apache.logging.log4j:log4j-core:2.17.0` 的哈希值。 然后,它会并发查询 [`deps.dev` query API][2],以检查是否有任何文件与已知的依赖项相匹配。 如果发现任何漏洞,提交将被中止。 与已知依赖项不匹配的文件将被忽略,但 API 或网络错误也会中止提交,因此该检查不会被静默绕过。 ## 要求 - [OpenSSL][3] - [cURL][4] 7.66 或更高版本 - [jq][5] ## 安装说明 将该脚本复制到您本地仓库的 `.git/hooks` 目录中。 ## 许可证 本仓库中的所有代码均基于 [the MIT license][6] 授权。
标签:Cutter, DevSecOps, Git Hooks, Shell脚本, 上游代理, 依赖安全, 安全测试工具, 安全防护