Last active
January 12, 2024 19:03
-
-
Save sunsided/cec429eaf7c51dd0374f207d68daa675 to your computer and use it in GitHub Desktop.
Create SBOMs in SPDX and CycloneDX format for a local repository
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
#!/usr/bin/env bash | |
set -euo pipefail | |
CACHE=$(realpath ~/.cache/trivy) | |
if [ $# -eq 0 ]; then | |
echo "Please specify a local repository to scan." | |
exit 1 | |
else | |
REPO=$(realpath $1) | |
docker run --rm -it --user "$(id -u):$(id -g)" -v "$CACHE:/.cache/trivy:rw" -v "$REPO:/code:rw" aquasec/trivy fs --format spdx-json --output /code/sbom-spdx.json /code | |
docker run --rm -it --user "$(id -u):$(id -g)" -v "$CACHE:/.cache/trivy:rw" -v "$REPO:/code:rw" aquasec/trivy fs --format cyclonedx --output /code/sbom-cyclonedx.json /code | |
fi | |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
if [ $# -eq 0 ]; then | |
echo "Please specify a local repository to scan." | |
exit 1 | |
else | |
REPO=$(realpath $1) | |
docker run --rm -it -v "$REPO:/code:ro" aquasec/trivy fs /code | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment