@@ -4,13 +4,14 @@ set -e -u
44# Define the file to store the list of vulnerabilities to ignore.
55IGNORE_FILE=" .vulnignore"
66
7+ go version
78# Check if the ignored vulnerabilities file exists. If not, create an empty one.
89if [ ! -f " $IGNORE_FILE " ]; then
9- touch " $IGNORE_FILE "
10- echo " Created an empty file to store ignored vulnerabilities: $IGNORE_FILE "
11- echo " # Add vulnerability IDs (e.g., GO-2022-0450) to ignore, one per line." >> " $IGNORE_FILE "
12- echo " # You can also add comments on the same line after the ID." >> " $IGNORE_FILE "
13- echo " " >> " $IGNORE_FILE "
10+ touch " $IGNORE_FILE "
11+ echo " Created an empty file to store ignored vulnerabilities: $IGNORE_FILE "
12+ echo " # Add vulnerability IDs (e.g., GO-2022-0450) to ignore, one per line." >> " $IGNORE_FILE "
13+ echo " # You can also add comments on the same line after the ID." >> " $IGNORE_FILE "
14+ echo " " >> " $IGNORE_FILE "
1415fi
1516
1617# Run govulncheck and capture its output.
@@ -35,18 +36,18 @@ UNIGNORED_VULNS=$(echo "$VULN_OUTPUT" | grep 'Vulnerability')
3536
3637# If the list of ignored vulnerabilities is not empty, filter them out.
3738if [ -n " $CLEAN_IGNORES " ]; then
38- UNIGNORED_VULNS=$( echo " $UNIGNORED_VULNS " | grep -vFf <( echo " $CLEAN_IGNORES " ) || true)
39+ UNIGNORED_VULNS=$( echo " $UNIGNORED_VULNS " | grep -vFf <( echo " $CLEAN_IGNORES " ) || true)
3940fi
4041
4142# If there are any vulnerabilities that were not in our ignore list, print them and exit with an error.
4243if [ -n " $UNIGNORED_VULNS " ]; then
43- echo " 🚨 Found new, unignored vulnerabilities:"
44- echo " -------------------------------------"
45- echo " $UNIGNORED_VULNS "
46- echo " -------------------------------------"
47- echo " Exiting with an error. ❌"
48- exit 1
44+ echo " 🚨 Found new, unignored vulnerabilities:"
45+ echo " -------------------------------------"
46+ echo " $UNIGNORED_VULNS "
47+ echo " -------------------------------------"
48+ echo " Exiting with an error. ❌"
49+ exit 1
4950else
50- echo " 🎉 No new vulnerabilities found. All clear! ✨"
51- exit 0
51+ echo " 🎉 No new vulnerabilities found. All clear! ✨"
52+ exit 0
5253fi
0 commit comments