@@ -23,31 +23,5 @@ while getopts 'b:c:s:' flag; do
2323done
2424
2525
26- # gosec => Scans go packages and flags security vulnerabilities
27- if [[ ! -v BRANCH_NAME ]]; then
28- # Running locally. Use a docker container.
29- # Exclude test files and the third party go-mssqldb library
30- excluded_directories=" /secretless/test,/secretless/third_party/go-mssqldb"
31- docker run --rm \
32- -v " $toplevel_dir /:/secretless/" \
33- secretless-dev \
34- bash -exc "
35- go install github.com/securego/gosec/v2/cmd/gosec@latest
36- git config --global --add safe.directory /secretless
37- ./bin/run_gosec -c ${confidence} -s ${severity} -b ${current_branch} -e ${excluded_directories}
38- "
39- else
40- # Running in Jenkins
41- # For some reason the third_party directory is not being excluded properly on main branch builds. It appears in two forms:
42- # /home/jenkins/agent/workspace/secretless-broker-main-full_main/third_party/go-mssqldb
43- # /home/jenkins/agent/workspace/secretless-broker-main-full_main/secretless-broker-main-full_main/third_party/go-mssqldb
44- # To accomodate the second case, we duplicate the name of the working directory to build the full path
45- # Note this still doesn't work even though we exclude both paths.
46- third_party_import_dir=" $( pwd) /$( basename " $( pwd) " ) /third_party/go-mssqldb"
47- excluded_directories=" $( pwd) /test,$( pwd) /third_party/go-mssqldb,$third_party_import_dir "
48- echo " Excluding directories: ${excluded_directories} "
49-
50- go install github.com/securego/gosec/v2/cmd/gosec@latest
51- git config --global --add safe.directory " ${WORKSPACE} "
52- ./bin/run_gosec -c " ${confidence} " -s " ${severity} " -b " ${current_branch} " -e " ${excluded_directories} "
53- fi
26+ excluded_directories=" test,third_party/go-mssqldb,bin/juxtaposer,cmd/shared"
27+ ./bin/run_gosec -c " ${confidence} " -s " ${severity} " -b " ${current_branch} " -e " ${excluded_directories} "
0 commit comments