|
@@ -20,11 +20,13 @@
|
|
|
# trivy-config Trivy Dockerfile/IaC scan only
|
|
# trivy-config Trivy Dockerfile/IaC scan only
|
|
|
# pip-audit Python dependency vulnerability audit
|
|
# pip-audit Python dependency vulnerability audit
|
|
|
# npm-audit Frontend dependency vulnerability audit
|
|
# npm-audit Frontend dependency vulnerability audit
|
|
|
|
|
+# gitleaks Secrets scan across full git history (slow — only in --full or by name)
|
|
|
#
|
|
#
|
|
|
# Prerequisites:
|
|
# Prerequisites:
|
|
|
# pip install bandit[sarif] pip-audit # Python tools
|
|
# pip install bandit[sarif] pip-audit # Python tools
|
|
|
# gh extension install github/gh-codeql # CodeQL CLI
|
|
# gh extension install github/gh-codeql # CodeQL CLI
|
|
|
# curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh # Trivy
|
|
# curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh # Trivy
|
|
|
|
|
+# go install github.com/zricethezav/gitleaks/v8@latest # gitleaks (ensure ~/go/bin on PATH)
|
|
|
#
|
|
#
|
|
|
|
|
|
|
|
set -uo pipefail
|
|
set -uo pipefail
|
|
@@ -208,6 +210,19 @@ scan_npm_audit() {
|
|
|
(cd frontend && npm audit --audit-level=high) 2>&1
|
|
(cd frontend && npm audit --audit-level=high) 2>&1
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+scan_gitleaks() {
|
|
|
|
|
+ local bin
|
|
|
|
|
+ if check_command gitleaks; then
|
|
|
|
|
+ bin="gitleaks"
|
|
|
|
|
+ elif [ -x "$HOME/go/bin/gitleaks" ]; then
|
|
|
|
|
+ bin="$HOME/go/bin/gitleaks"
|
|
|
|
|
+ else
|
|
|
|
|
+ echo "SKIP: 'gitleaks' not found. Install: go install github.com/zricethezav/gitleaks/v8@latest"
|
|
|
|
|
+ return 2
|
|
|
|
|
+ fi
|
|
|
|
|
+ "$bin" detect --source . --redact --no-banner --verbose 2>&1
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
# ── Job launcher (streams output live with prefix, captures to log) ──────
|
|
# ── Job launcher (streams output live with prefix, captures to log) ──────
|
|
|
|
|
|
|
|
launch_scan() {
|
|
launch_scan() {
|
|
@@ -363,13 +378,13 @@ SCANS_TO_RUN=()
|
|
|
if [ $# -eq 0 ]; then
|
|
if [ $# -eq 0 ]; then
|
|
|
SCANS_TO_RUN=(bandit pip-audit npm-audit)
|
|
SCANS_TO_RUN=(bandit pip-audit npm-audit)
|
|
|
elif [ "$1" = "--full" ]; then
|
|
elif [ "$1" = "--full" ]; then
|
|
|
- SCANS_TO_RUN=(bandit pip-audit npm-audit codeql-actions codeql-python codeql-js trivy-image trivy-config)
|
|
|
|
|
|
|
+ SCANS_TO_RUN=(bandit pip-audit npm-audit codeql-actions codeql-python codeql-js trivy-image trivy-config gitleaks)
|
|
|
else
|
|
else
|
|
|
for scan in "$@"; do
|
|
for scan in "$@"; do
|
|
|
case "$scan" in
|
|
case "$scan" in
|
|
|
codeql) SCANS_TO_RUN+=(codeql-actions codeql-python codeql-js) ;;
|
|
codeql) SCANS_TO_RUN+=(codeql-actions codeql-python codeql-js) ;;
|
|
|
trivy) SCANS_TO_RUN+=(trivy-image trivy-config) ;;
|
|
trivy) SCANS_TO_RUN+=(trivy-image trivy-config) ;;
|
|
|
- bandit|codeql-actions|codeql-python|codeql-js|trivy-image|trivy-config|pip-audit|npm-audit)
|
|
|
|
|
|
|
+ bandit|codeql-actions|codeql-python|codeql-js|trivy-image|trivy-config|pip-audit|npm-audit|gitleaks)
|
|
|
SCANS_TO_RUN+=("$scan") ;;
|
|
SCANS_TO_RUN+=("$scan") ;;
|
|
|
*)
|
|
*)
|
|
|
echo -e "${RED}Unknown scan: $scan${NC}"
|
|
echo -e "${RED}Unknown scan: $scan${NC}"
|
|
@@ -391,6 +406,7 @@ for scan in "${SCANS_TO_RUN[@]}"; do
|
|
|
trivy-config) launch_scan "trivy-config" scan_trivy_config ;;
|
|
trivy-config) launch_scan "trivy-config" scan_trivy_config ;;
|
|
|
pip-audit) launch_scan "pip-audit" scan_pip_audit ;;
|
|
pip-audit) launch_scan "pip-audit" scan_pip_audit ;;
|
|
|
npm-audit) launch_scan "npm-audit" scan_npm_audit ;;
|
|
npm-audit) launch_scan "npm-audit" scan_npm_audit ;;
|
|
|
|
|
+ gitleaks) launch_scan "gitleaks" scan_gitleaks ;;
|
|
|
esac
|
|
esac
|
|
|
done
|
|
done
|
|
|
|
|
|