DTrackAuditor is the python script to ease usage of DependencyTrack in the CI, optionally failing the build based on different parameters.
Pypi
thinksabin@DESKTOP:~$ pip install dtrack-auditor
thinksabin@DESKTOP:~$ dtrackauditor
Docker image
docker pull thinksabin/dtrackauditor:latest
Git
git clone https://github.com/thinksabin/DTrackAuditor.git
python3 dtrackauditor.py \
-u 'http://mydtrack.local:8080' \
-k 'mydtrackapikey' \
-p myweb -v 1.0.0 \
-f myweb/target/bom.xml \
-a
(.venv) PS C:\Users\dells\OneDrive\Documents\GitHub\DTrackAuditor\dtrackauditor> ..\.venv\Scripts\python.exe .\dtrackauditor.py -a -u 'http://mydtrack.local:8080' -k 'mydtrackapikey' -p ddweb -v 1.0.0 -f .\test\bom.xml --wait
If environment variable for DTRACK_SERVER
and DTRACK_API_KEY
are present then the usage can be direct:
python3 dtrackauditor.py -p myweb -v 1.0.0 -a
If your DependencyTrack server is exposed through an HTTPS listener (e.g.
using an nginx or apache web-server as a reverse proxy for the UI and API
servers), and if this setup uses self-signed certificates or those issued by
a private (corporate) Certificate Authority, you may benefit from passing
a path to PEM file with the trust chain using DTRACK_SERVER_CERTCHAIN
environment variable or the -C
/--certchain
command-line argument.
Such argument may also be none
to trust any HTTPS server blindly.
docker run --rm -v $PWD:/tmp \
thinksabin/dtrackauditor -- \
required parameters as examples
Auto mode for CI/CD with support for rules.
python3 dtrackauditor.py \
-u http://mydtrack.local:8080 \
-k mydtrackapikey \
-p hello \
-v 8.0.0 \
-a \
-r critical:1:true,high:2:true,medium:10:true,low:10:false
The rules are a list of:
<severity>:<count>:<action>
Where:
critical
, high
, medium
, low
, or unassigned
severity
is greater or equal, trigger action
true
to fail the test, false
to just display a warning (default is true
)DtrackAuditor return with code 1 (fails the test) in case any Policy Violations detected. This feature is not configurable and cannot be disabled using command line options.
Please create issues for bug reports and suggestions. Thanks.