在本地导入 Tenable One 代码仓库发现¶
在 Tenable Exposure Management Inventory 中选择一个代码仓库。复制其资产 UUID 以及您想要的发现 UUID。在您的源代码控制系统中独立验证 HTTPS 克隆 URL,并使用具有匹配 Git fetch remote 的检出副本。Tenable 资产详情
导出所选内容¶
下载和 CSV 捕获辅助脚本 属于 Codex Security 源代码仓库的一部分。请在该仓库的根目录下运行 Python 命令。为在 cloud.tenable.com 上具有 Inventory Export API 访问权限的租户设置 TENABLE_ACCESS_KEY 和 TENABLE_SECRET_KEY,或使用现有的 CSV 导出。请将报告保存在源代码仓库和您要导入其发现的检出副本之外。
umask 077
reports=/private/path/tenable-export
mkdir -p "$reports"
asset_id=SELECTED_ASSET_UUID
repository_url=https://github.com/example/project
checkout=/path/to/project
python3 examples/tenable-one/download.py --asset-id "$asset_id" \
--finding-id SELECTED_FINDING_UUID --repository-url "$repository_url" \
--output "$reports/selection.json"
对额外的发现重复 --finding-id。该辅助脚本会分别请求资产和发现导出,轮询完成状态,下载 CSV 分块,并对照所选资产检查每项发现。导出资产 · 导出发现 · 导出状态 · 下载分块
从现有 CSV 导出¶
使用带有机器可读表头的未压缩 CSV(use_readable_name=false)。资产导出需要 asset_id,asset_class,asset_name。发现导出需要所选仓库的 asset_id,finding_id,finding_name,finding_severity,state。默认的标题表头 finding_detection_name 也被接受。如可用,请包含 finding_description 和 finding_solution。资产属性 · 发现属性
python3 examples/tenable-one/capture.py --assets "$reports/assets.csv" \
--findings "$reports/findings.csv" --asset-id "$asset_id" \
--repository-url "$repository_url" --output "$reports/selection.json"
在 --findings 之后传入额外的发现分块。要保留文件位置,请添加 --path-column file_path --line-column code_line_number,并替换为您租户中的实际列名。路径是相对于仓库的。行号为零则表示不指定具体行。
预览、保存并读回¶
使用已安装的 CLI 为本地检出副本预览所选内容。选择一个稳定的租户别名,并在重复导入时将其与资产 UUID 一起放在 --source-key 中。
codex-security publish findings "$reports/selection.json" --provider tenable \
--to local --repository "$checkout" --source-repository-url "$repository_url" \
--source-key "TENANT_ALIAS/$asset_id" --dry-run --format json
根据您的选择检查预览。仓库 URL 用于标识映射到 Tenable 资产的代码仓库。对于已报告的代码位置,请检查 evidence.locations。厂商描述位于 evidence.description 中。原始状态和可选的解决方案位于 evidence.source_data.finding 中。
移除 --dry-run 并确认以保存。运行 codex-security findings imported "$checkout" --format json 以读回准确的 Tenable 发现 ID 及其初始的 not_assessed Codex 评估。重复使用 source key 会更新已变更的证据,并保留相同发现的版本。
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 co/codex-security