gitlab linux grep fail if found

Background

During the log4j vulnerability the need to stop deployments so verification of remediation was complete, therefore, the need to grep a files output of our security scan was needed.  The use of trivy was being used in scanning the docker containers for vulnerabilities.  Another line was simply added to grep for the CVE and exit 1 if found

Gitlab Pipelines Content

 

trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --severity $TRIVY_SEVERITY --vuln-type os,library -i images/\$DT_DEPLOYABLE.tar >> \$DT_DEPLOYABLE.scan.txt

 

if [ $(grep -c CVE-2021-44228 *.scan.txt) -ne 0 ]; then exit 1; fi

Comments

Popular posts from this blog

ColdFusion in an Enterprise Environment - Part 1 - Understanding how to use SubVersion (SVN)

coldfusion builder 2 extension not displaying browse button on type=projectdir

Being Thread Safe in Coldbox/Coldfusion