
CycloneDX SBOMをJSON、XML、Protobuf、CSV、SPDX形式で生成、解析、マージ、差分比較、検証、署名、変換するCLI。
______ __ ____ _ __ ________ ____
/ ____/_ _______/ /___ ____ ___ / __ \ |/ / / ____/ / / _/
/ / / / / / ___/ / __ \/ __ \/ _ \/ / / / / / / / / / /
/ /___/ /_/ / /__/ / /_/ / / / / __/ /_/ / | / /___/ /____/ /
\____/\__, /\___/_/\____/_/ /_/\___/_____/_/|_| \____/_____/___/
/____/
Usage:
cyclonedx [command] [options]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
add Add information to a BOM (currently supports files)
analyze Analyze a BOM file
convert Convert between different BOM formats
diff <from-file> <to-file> Generate a BOM diff
keygen Generates an RSA public/private key pair for BOM signing
merge Merge two or more BOMs
sign Sign a BOM or file
validate Validate a BOM
verify Verify signatures in a BOM
CycloneDX CLIツールは現在、BOMの分析、変更、差分生成、マージ、フォーマット変換、署名、検証をサポートしています。
CycloneDX XML、JSON、Protobuf、CSV、SPDX JSON v2.3間の変換がサポートされています。
バイナリはリリースページからダウンロードできます。
注:CycloneDX CLIツールは自動化ユースケース向けに構築されています。--input-fileオプションを持つコマンドはすべて、stdinからの入力にも対応しています。同様に、--output-fileオプションを持つコマンドはすべて、stdoutへの出力にも対応しています。ただし、入出力フォーマットの指定が必要です。
例:
cat bom.json | cyclonedx-cli convert --input-format json --output-format xml > bom.xml
files
Add files to a BOM
Usage:
cyclonedx add files [options]
Options:
--input-file <input-file> Input BOM filename.
--no-input Use this option to indicate that there is no input BOM.
--output-file <output-file> Output BOM filename, will write to stdout if no value provided.
--input-format <autodetect|json|protobuf|xml> Specify input file format.
--output-format <autodetect|json|protobuf|xml> Specify output file format.
--base-path <base-path> Base path for directory to process (defaults to current working directory if omitted).
--include <include> Apache Ant style path and file patterns to specify what to include (defaults to all files, separate patterns with a space).
--exclude <exclude> Apache Ant style path and file patterns to specify what to exclude (defaults to none, separate patterns with a space).
Gitリポジトリのディレクトリを除外して、ソースコードBOMを生成:
cyclonedx-cli add files --no-input --output-format json --exclude /.git/**
既存のBOMにbinディレクトリのビルド出力ファイルを追加:
cyclonedx-cli add files --input-file bom.json --output-format json --base-path bin
analyze
Analyze a BOM file
Usage:
cyclonedx analyze [options]
Options:
--input-file <input-file> Input BOM filename, will read from stdin if no value provided.
--input-format <autodetect|json|protobuf|xml> Specify input file format.
--output-format <json|text> Specify output format (defaults to text).
--multiple-component-versions Report components that have multiple versions in use.
異なるバージョンで複数回含まれているコンポーネントをレポート:
cyclonedx-cli analyze --input-file sbom.xml --multiple-component-versions
convert
Convert between different BOM formats
Usage:
cyclonedx convert [options]
Options:
--input-file <input-file> Input BOM filename, will read from stdin if no value provided.
--output-file <output-file> Output BOM filename, will write to stdout if no value provided.
--input-format <autodetect|csv|json|protobuf|spdxjson|xml> Specify input file format.
--output-format <autodetect|csv|json|protobuf|spdxjson|xml> Specify output file format.
--output-version <v1_0|v1_1|v1_2|v1_3|v1_4|v1_5|v1_6|v1_7> Specify output BOM specification version. (ignored for CSV and SPDX formats)
XMLからJSON形式への変換:
cyclonedx-cli convert --input-file sbom.xml --output-file sbom.json
XMLからJSON形式に変換して出力を他のツールにパイプ:
cyclonedx-cli convert --input-file sbom.xml --output-format json | grep "somthing"
CSVフォーマットは、BOM内のコンポーネントのリストを限定して表現したものです。
これは、ユーザーが単純なユースケース向けにBOMを簡単に生成・利用できる方法を提供することを意図しています。単純なデータ移行のユースケースも含みます。
必須フィールドはコンポーネントのnameとversionのみです。その他は空欄のままにするか、列ごと省略できます。
SPDX形式とCycloneDX形式の間で変換すると、一部の情報が失われる可能性があります。変換機能は、CycloneDX .NETライブラリプロジェクトの一部であるCycloneDX.Spdx.Interopライブラリによって提供されています。
失われる情報の詳細については、CycloneDX .NETライブラリのプロジェクトページを参照してください。
diff
Generate a BOM diff
Usage:
cyclonedx diff <from-file> <to-file> [options]
Arguments:
<from-file> From BOM filename.
<to-file> To BOM filename.
Options:
--from-format <autodetect|json|protobuf|xml> Specify from file format.
--to-format <autodetect|json|protobuf|xml> Specify to file format.
--output-format <json|text> Specify output format (defaults to text).
--component-versions Report component versions that have been added, removed or modified.
バージョンが変更されたコンポーネントをレポート:
cyclonedx-cli diff sbom-from.xml sbom-to.xml --component-versions
keygen
Generates an RSA public/private key pair for BOM signing
Usage:
cyclonedx keygen [options]
Options:
--private-key-file <private-key-file> Filename for generated private key file (defaults to "private.key")
--public-key-file <public-key-file> Filename for generated public key file (defaults to "public.key")
merge
Merge two or more BOMs
Usage:
cyclonedx merge [options]
Options:
--input-files <input-files> Input BOM filenames (separate filenames with a space).
--output-file <output-file> Output BOM filename, will write to stdout if no value provided.
--input-format <autodetect|json|protobuf|xml> Specify input file format.
--output-format <autodetect|json|protobuf|xml> Specify output file format.
--output-version <v1_0|v1_1|v1_2|v1_3|v1_4|v1_5|v1_6|v1_7> Specify output BOM specification version.
--hierarchical Perform a hierarchical merge.
--group <group> Provide the group of software the merged BOM describes.
--name <name> Provide the name of software the merged BOM describes (required for hierarchical merging).
--version <version> Provide the version of software the merged BOM describes (required for hierarchical merging).
注:階層マージを実行するには、すべてのBOMのmetadataコンポーネント要素に、マージ対象のBOMが記述されている必要があります。
2つのXML形式のBOMをマージ:
cyclonedx-cli merge --input-files sbom1.xml sbom2.xml --output-file sbom_all.xml