Checkmarx/dustilock

GitHub: Checkmarx/dustilock

DustiLock 是一款用于检测项目私有依赖是否在公共仓库中被恶意抢注的供应链安全扫描工具。

Stars: 40 | Forks: 7

![readme 封面图片](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/5ba38ca9f0112923.png) DustiLock 是一个用于发现你的依赖项中哪些容易受到 Dependency Confusion 攻击的工具。 ## 什么是 Dependency Confusion? 这是一种由 [@alex.birsan](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610) 发现的技术,通过在公共 registry 上注册被私有使用的包的名称(如果可用)并使用更高的版本号来劫持该包。这可能会导致 artifact 服务器和构建工具产生“混淆”并使用攻击者的包。 ![Frame 237 (1)](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/d33435b894112925.png) ## 命令行界面 (CLI) ### 构建 ``` go build ./dustilock ``` ### CLI 参数 - `-r` - 递归扫描 (默认=false) - `-p ` - 自定义扫描路径 (默认=当前工作目录) - `-a` - 仅审计,检测到问题不会失败 (默认=false) **示例** ``` ./dustilock -p /tmp/code -r DustiLock started scanning directory "/tmp/code" (recursive=true) ... error - npm package "private-org-infra" is available for public registration. /tmp/code/test-project/package.json one or more packages are available for public registration ``` ## 在 CI Workflows 中使用 该工具可以轻松集成到现代 CI workflows 中以测试新的代码贡献。 ### 在 GitHub Actions 中使用 将以下内容作为步骤添加到你的 workflow 文件中: ``` - name: DustiLock uses: checkmarx/dustilock@v1.2.0 ``` 覆盖默认值: ``` - name: DustiLock uses: checkmarx/dustilock@v1.2.0 with: recursive: true path: my-nested-project # disable failing the build when having alerts (default = false) audit: true ``` ### 如何处理有风险的包? 为了降低风险,你需要使用与内部包相同的名称(如果有)注册一个虚拟占位包,以防止此类攻击。注册时,请使用较低的版本号(例如 0.0.1),这样它就不会被用来替代你的内部包。 ### 支持的语言 目前,该工具可以检查: - `requirements.txt` - Python - `package.json` - npm ### 致谢 - Alex Birsan 分享了[他的研究](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610)并帮助保护开源供应链的安全。 - https://github.com/davidfischer/requirements-parser 提供了关于 Python requirements.txt 依赖项的示例 # 许可证 Apache-2.0 License Copyright (c) 2021 Checkmarx
标签:Checkmarx, CI/CD安全, DevSecOps, EVTX分析, EVTX分析, EVTX分析, GitHub Actions, Go语言, Llama, MITM代理, NPM安全, 上游代理, 云安全监控, 依赖混淆, 包管理器安全, 文档结构分析, 日志审计, 程序破解, 自动笔记, 软件开发工具包, 逆向工具, 防护工具, 静态分析