Created
June 8, 2020 05:24
-
-
Save haohaolee/9592c911b7ea32132481e3d2da237a75 to your computer and use it in GitHub Desktop.
OWASP dependency check script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DC_VERSION="latest" | |
DC_DIRECTORY=$HOME/OWASP-Dependency-Check | |
DC_PROJECT="dependency-check scan: $(pwd)" | |
DATA_DIRECTORY="$DC_DIRECTORY/data" | |
CACHE_DIRECTORY="$DC_DIRECTORY/data/cache" | |
if [ ! -d "$DATA_DIRECTORY" ]; then | |
echo "Initially creating persistent directory: $DATA_DIRECTORY" | |
mkdir -p "$DATA_DIRECTORY" | |
fi | |
if [ ! -d "$CACHE_DIRECTORY" ]; then | |
echo "Initially creating persistent directory: $CACHE_DIRECTORY" | |
mkdir -p "$CACHE_DIRECTORY" | |
fi | |
# Make sure we are using the latest version | |
docker pull owasp/dependency-check:$DC_VERSION | |
docker run --rm \ | |
-e user=$USER \ | |
-u $(id -u ${USER}):$(id -g ${USER}) \ | |
--volume $(pwd):/src:z \ | |
--volume "$DATA_DIRECTORY":/usr/share/dependency-check/data:z \ | |
--volume $(pwd)/odc-reports:/report:z \ | |
owasp/dependency-check:$DC_VERSION \ | |
--scan /src \ | |
--format "ALL" \ | |
--project "$DC_PROJECT" \ | |
--out /report | |
# Use suppression like this: (where /src == $pwd) | |
# --suppression "/src/security/dependency-check-suppression.xml" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment