OWASP Dependency Track CLI
A CLI for CI/CD usage.
Installation
pip install owasp-dependency-track-cli
Usage
export OWASP_DTRACK_URL="http://localhost:8081"
export OWASP_DTRACK_VERIFY_SSL="False"
export OWASP_DTRACK_API_KEY="xyz"
export SEVERITY_THRESHOLD_HIGH="3"
owasp-dtrack-cli test --project-name webapp --auto-create test/files/test.sbom.xml
As Container runtime:
podman|docker \
run --rm -v"$(pwd):$(pwd)" \
-eOWASP_DTRACK_URL="http://192.168.1.100:8081" \
-eOWASP_DTRACK_VERIFY_SSL="false" \
-eOWASP_DTRACK_API_KEY="xyz" \
ghcr.io/mreiche/owasp-dependency-track-cli:latest test --project-name webapp2 --auto-create "$(pwd)/test/files/test.sbom.xml"
Commands
test: Uploads a SBOM, analyzes and reports the according projectupload: Uploads a SBOM onlyanalyze: Analyzes and reports a projectreport: Creates a report onlymetrics prometheus: Provides Prometheus metrics asowasp_dtrack_cvss_scoreandowasp_dtrack_violationsGauge seriesproject upsert: Upserts a project by file or JSON stringproject remove-property: Removes a property from a projectproject activate: Activates a project and adds thekeepActivepropertyproject deactivate: Deactivates a project and removes thekeepActiveproperty
Examples
owasp-dtrack-cli upload --parent-name "MyGroup" /path/to/sbom.json
owasp-dtrack-cli analyze --project-name "My project" --latest
owasp-dtrack-cli test --auto-create /path/to/sbom.json
owasp-dtrack-cli metrics prometheus --serve
owasp-dtrack-cli project upsert --json '{ "name": "My project" }'
Environment variables
OWASP_DTRACK_URL="http://localhost:8081" # Base-URL to OWASP Dependency Track
OWASP_DTRACK_VERIFY_SSL="False" # Do not verify SSL
OWASP_DTRACK_API_KEY="xyz" # Your OWASP Dependency Track API Key (see below)
SEVERITY_THRESHOLD_[CRITICAL|HIGH|MEDIUM|LOW|UNASSIGNED]="-1" # Threshold for findings severity
VIOLATION_THRESHOLD_[FAIL|WARN|INFO]="-1" # Threshold for policy violations
CVSS_V3_THRESHOLD="-1" # Threshold for cumulated CVSS V3
CVSS_V2_THRESHOLD="-1" # Threshold for cumulated CVSS V2
ANALYZE_TIMEOUT_SEC="300" # Timeout for analyzation in seconds
PROJECT_TIMEOUT_SEC="20" # Timeout for searching the project by name in seconds
HTTPS_PROXY="" # URL for HTTP(S) proxy
LOG_LEVEL="info" # Logging verbosity (optional)
HTTPX_LOG_LEVEL="warning" # Log level of the httpx framework (optional)
API-Key
Setup a user with API key and the following permissions:
- Goto Teams -> Automation
- Add API-Key
- Add Permissions
- SBOM_UPLOAD
- PROJECT_CREATION_UPLOAD (for the auto-create feature)
- VIEW_VULNERABILITY
- VIEW_POLICY_VIOLATION
- PORTFOLIO_MANAGEMENT (for modifying projects)
How it works
sequenceDiagram
actor User
User->>CLI: Provide SBOM
CLI->>+OWASP DT: Clone project as new version
OWASP DT->>-CLI: New project version
CLI->>+OWASP DT: Upload and analyze SBOM
OWASP DT->>-CLI: Return findings
CLI->>OWASP DT: Deactivate older versions
CLI->>+CLI: Generate findings report
CLI->>+CLI: Analyze thresholds
CLI->>User: Print findings report
Explanation of implementation behaviour.
About patching a project
Every patch activates the project, to keep it deactivated, add to your patch:
{ "active": false }
or use the project deactivate command afterwards.
Uploading new project versions
The upload and test commands behave like the following:
- If the
--auto-create=true, a new--project-versionis provided and a previous uploaded version exists, it will be cloned as new version including properties and audit trail unless--clone=false - All other project versions without
keepActiveproperty will be deactivated unless--deactivate-others=false. This property can be added manually or via theproject activatecommand - If
--latestis set, this new project version will be marked as Latest
Development
- Install the requirements:
pip install -e ".[test]"oruv sync --extra test - Start the test environment
cd test podman|docker compose up
- Preconfigured user:
admin:admin2 - Preconfigured API key: see
test/test.env
- Preconfigured user:
Metadata
Release files for owasp-dependency-track-cli 5.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| owasp_dependency_track_cli-5.1.3.tar.gz | 17.9 kB | Without provenance | Details for owasp_dependency_track_cli-5.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| owasp_dependency_track_cli-5.1.3-py3-none-any.whl | Python 3 | none | any | Details for owasp_dependency_track_cli-5.1.3-py3-none-any.whl |
Total release size: 36.5 kB
Release files / owasp_dependency_track_cli-5.1.3.tar.gz
| Download URL | owasp_dependency_track_cli-5.1.3.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6c17362c978ba7ef6dc9e0bddc2af2ff7f9ff7d5bf48b500c9ae14e5af4bbec
|
|
BLAKE2b-256 checksum How to use checksums |
5c627c5d9aff11a33ff444d236bc10b008fe844fc82b9757b8dd83901180e9d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / owasp_dependency_track_cli-5.1.3-py3-none-any.whl
| Download URL | owasp_dependency_track_cli-5.1.3-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7befd3b0dcf4a033829136f9c8f282778e2fe1e1b42a85d90ecc7042d2a76d9
|
|
BLAKE2b-256 checksum How to use checksums |
cd6fae3b80c4dd39e337bd3d98b0359f1077bc1b74c3c5acbed8c6c49fbf6b2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for owasp-dependency-track-cli 5.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.