使用 conan audit¶
conan audit 命令提供了一种内置方法来**扫描您的依赖项是否存在已知的 CVE**。
有关身份验证、用法示例、输出格式以及设置私有提供程序的逐步指南,请参阅 检查软件包漏洞。简而言之
在 audit.conan.io 处**注册**。
**激活您的帐户**,通过您收到的确认电子邮件进行操作。
**保存您的令牌**,该令牌在激活后页面上显示。
配置 Conan 以使用您的令牌:
conan audit provider auth conancenter --token=<token>
运行扫描
# Check a specific reference
conan audit list zlib/1.2.13
# Scan the entire dependency graph
conan audit scan . # Path to the conanfile.py/txt
此命令还支持将您自己的 JFrog 平台用作漏洞扫描的私有提供程序。有关更多详细信息,请参阅 添加私有提供程序 部分。
过滤查询的软件包¶
默认情况下,conan audit scan 命令将查询依赖图中所有软件包。您可以使用 --context 选项过滤要查询的软件包,该选项接受 "host" 或 "build" 作为值,并且在省略时,默认查询两种上下文。
这允许您跳过检查构建需求中的 CVE,构建需求不是最终产品的一部分,因此对于漏洞扫描而言不太相关(但仍然重要!)。
也可以使用 conan audit list 命令执行此过滤,方法是利用 conan list 命令中的软件包列表过滤功能。例如
# Generate the dependency graph in JSON format
$ conan graph info . --format=json > graph.json
# Create a packages list for the resolved dependency graph, filtering to only contain the `host` context packages
$ conan list --graph=graph.json --graph-context=host --format=json > pkglist.json
# Scan the filtered packages list for vulnerabilities
$ conan audit list --list=pkglist.json
另请参阅
有关所有
conan audit子命令及其选项的详细参考文档,请参阅 conan audit 命令参考。在专用的博客文章中阅读更多。