This article demonstrates upgrading Spring Security, configuring OWASP ZAP to ignore warnings, and adjusting Dependency-Check thresholds for continuous security in CI/CD pipelines.
In this walkthrough, we’ll demonstrate how to
Upgrade a vulnerable Spring Security dependency.
Configure OWASP ZAP API scan to ignore expected warnings.
Adjust OWASP Dependency-Check thresholds and verify results.
Integrating these steps into your CI/CD pipeline ensures continuous security hygiene for new code and dependencies.
Modify your scan script to reference zap_rules and generate an HTML report:
Copy
Ask AI
#!/bin/bashPORT=$(kubectl get svc ${serviceName} -o json | jq .spec.ports[].nodePort)docker run -v $(pwd):/zap/wrk/:rw -t owasp/zap2docker-weekly \ zap-api-scan.py \ -t $applicationURL:$PORT/v3/api-docs \ -f openapi \ -c zap_rules \ -r zap_report.htmlexit_code=$?echo "Exit Code: $exit_code"if [[ $exit_code -ne 0 ]]; then echo "OWASP ZAP Report has risks. Check zap_report.html" exit 1else echo "OWASP ZAP did not report any risk." exit 0fi
Commit both zap_rules and zap.sh, then start a Jenkins build.
In the ZAP stage logs, you’ll see ignored rules:
Copy
Ask AI
...IGNORE-NEW: Unexpected Content-Type was returned [10001] x 30IGNORE-NEW: A Server Error response code was returned [10000] x 8FAIL-NEW: 0 WARN-NEW: 0 IGNORE: 2 PASS: 115Exit Code: 0OWASP ZAP did not report any risk.
Lowering the failBuildOnCVSS threshold may allow medium-risk vulnerabilities to pass the build. Only do this after ensuring critical issues are remediated.
Push your changes and review the Dependency-Check results in Jenkins:
Finally, rerun the Trivy scan to confirm there are zero issues:
Copy
Ask AI
bash trivy-k8s-scan.sh
Copy
Ask AI
Total: 0 (LOW: 0, MEDIUM: 0, HIGH: 0)Exit Code: 0Image scanning passed. No vulnerabilities found
By upgrading Spring Security, customizing OWASP ZAP scans, and tuning Dependency-Check thresholds, you can maintain a secure codebase and reduce noise from expected warnings. Automate these steps in your CI/CD pipeline to enforce continuous security validation.