Tools and CLI for handling BDSCA analysis configuration file(s).
Project description
bdsca-analysis-config-file
Utilities and CLI to validate and work with BDSCA analysis configuration files (YAML).
Features implemented: validation, vulnerability triage, adding components by PURL, and overwriting component versions in the BOM.
CLI Usage
All commands are available via the bdsca-config CLI:
Show Version
bdsca-config --version
Validate a YAML Configuration File
bdsca-config validate <config.yaml> [--output yaml|json|summary] [--target]
- Validates the file and prints errors in a table if invalid.
- Use
--outputto pretty-print the file in YAML, JSON, or summary format. - Use
--targetto print the effective change target (project info).
Add Missing Components to BOM
bdsca-config add-components <config.yaml> --base-url <BLACKDUCK_URL> --api-token <TOKEN> [--insecure] [--verbosity info|debug]
- Adds missing components from
componentAdditionsto the BOM for each project in the config. - Only the
purlfield is allowed incomponentAdditions.component. Extra fields are rejected by schema validation.
Example config:
componentAdditions:
- component:
purl: pkg:pypi/sample@1.0.0
Remediate Vulnerabilities
bdsca-config remediate <config.yaml> --base-url <BLACKDUCK_URL> --api-token <TOKEN> [--insecure] [--verbosity info|debug] [--dryrun]
- Validates the file and performs remediation using Black Duck.
- Use
--dryrunto preview changes without making updates.
Overwrite Component Version
bdsca-config overwrite <config.yaml> --base-url <BLACKDUCK_URL> --api-token <TOKEN> [--insecure] [--verbosity info|debug] [--dryrun]
- Reads the
overridessection and updates matching BOM component versions. - If
newVersionis provided, the component's version in the project BOM is updated by resolving component versions and origins. - Supports
--dryrunto preview without making changes.
Examples
Minimal overrides using component name/vendor and newVersion:
specVersion: "1"
overrides:
- component:
name: Apache Commons IO
version: "2.2"
vendor: "maven"
newVersion: "2.3"
- component:
name: node-semver
version: "5.7.2"
vendor: "npmjs"
newVersion: "5.7.1"
- component:
name: AsciidoctorJ
version: ""
vendor: "maven"
newVersion: "0.1.3"
changeTarget:
- project:
name: HippotechOrg/sampleapp
version: "main"
Run in dry-run mode to preview:
bdsca-config overwrite examples/example4.yaml --base-url <BLACKDUCK_URL> --api-token <TOKEN> --dryrun
Notes:
- The
vendorshould match the origin name in Black Duck (e.g.,maven,npmjs). - If the component exists in the BOM and
newVersionresolves to a valid component version/origin, the tool will construct and apply the version change;--dryrunpreviews without changing. - PURL is not supported for the
overwritecommand; use componentname(and optionallyversion) withvendorto target the correct origin.
Module Usage
You can also run commands via Python module execution:
python -m bdsca_analysis_config_file --version
python -m bdsca_analysis_config_file validate examples/example.yaml
Configuration Shape & Examples
specVersion: "1"changeTarget: array of targets; each target is an object with a required project:
changeTarget:
- project:
name: example-project
version: "1.0"
- project:
name: another-project
version: "main"
vulnerabilityTriagesare specified at the top level and apply to all target projects:
vulnerabilityTriages:
- component:
name: lib-a
vendor: vendor-a
version: "1.2.3"
triages:
- cve: CVE-2024-0001
resolution: PATCHED
comment: fixed upstream
componentAdditionsfor adding components by purl:
componentAdditions:
- component:
purl: pkg:pypi/sample@1.0.0
Overrides example:
overrides:
- component:
name: example-component
vendor: ExampleVendor
version: "1.0.0"
newVersion: "1.0.1"
Output Examples
- Single project summary:
bdsca-config validate examples/example.yaml --output summary --target
...
target: project name='example-project' version='1.0'
- Multiple projects summary:
bdsca-config validate examples/example2.yaml --output summary --target
...
target:
- project name='HippotechOrg/sampleapp' version='main'
- project name='HippotechOrg/anotherapp' version='1.2.3'
Features
- Modern src/ layout with pyproject.toml
- CLI with validation, remediation, and BOM addition
- Tests via pytest, lint via ruff and black, typing via mypy
- Pre-commit hooks and GitHub Actions CI
Quickstart
Install in editable mode with dev tools and run tests:
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -U pip
pip install -e .[dev]
pytest
Installation
To install the package locally after building:
python -m build
pip install dist/bdsca_analysis_config_file-<version>-py3-none-any.whl
Replace <version> with the actual version number (e.g. 0.1.2).
To install from PyPI or TestPyPI:
pip install bdsca-analysis-config-file
Or from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple bdsca-analysis-config-file
Release documentation
See the dedicated guide in docs/release.md for release workflow and options.
Dry-run Mode
- Use the
--dryrunflag with theremediateoroverwritecommands to preview changes without updating Black Duck. - The CLI prints current values and the new values that would be applied.
- No PUT requests are sent in dry-run mode, and the command returns success if the preview steps complete.
Target display
- Single project summary:
bdsca-config validate examples/example.yaml --output summary --target
...
target: project name='example-project' version='1.0'
- Multiple projects summary lists each project on its own line:
bdsca-config validate examples/example2.yaml --output summary --target
...
target:
- project name='HippotechOrg/sampleapp' version='main'
- project name='HippotechOrg/anotherapp' version='1.2.3'
License
MIT © Jouni Lehto
Release documentation
See the dedicated guide in docs/release.md for release workflow and options.
Dry-run mode
- Use the
--dryrunflag with theremediatecommand to see what would change without making any updates to Black Duck. - For each matched vulnerable component, the CLI prints the current remediation status and comment alongside the new values that would be applied.
- No PUT requests are sent in dry-run mode, and the command returns success if the preview steps complete.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bdsca_analysis_config_file-0.1.4.tar.gz.
File metadata
- Download URL: bdsca_analysis_config_file-0.1.4.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17910c014a7b9e23e99964633dd591857a1639469dc32ed93c32a45e684c82e6
|
|
| MD5 |
65bd2ea126b0843add6240b6c1784f27
|
|
| BLAKE2b-256 |
1b63e085c5daf21cc5665bc4951bfd96d4e95e2700b5e6e5130352bc246e858e
|
File details
Details for the file bdsca_analysis_config_file-0.1.4-py3-none-any.whl.
File metadata
- Download URL: bdsca_analysis_config_file-0.1.4-py3-none-any.whl
- Upload date:
- Size: 24.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7e286ba5c59b03feafec7989eeee37fdcff459001c918fb6d2ca0b17456c868
|
|
| MD5 |
04ee21291f9a2d204b75c09e2bfcc365
|
|
| BLAKE2b-256 |
41e9e772014c9351e220f054bebc572ef1d65f754a3d2b97aae8b0347461c0ce
|