From e496a75810da07215662d973b1348e756338fbe7 Mon Sep 17 00:00:00 2001 From: Fernando Alfaro Campos Date: Wed, 19 Mar 2025 09:10:02 -0400 Subject: [PATCH 1/2] Exclude generated code from being processed by gosec --- gosec-runner/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gosec-runner/entrypoint.sh b/gosec-runner/entrypoint.sh index 45885dca..524fc3c3 100755 --- a/gosec-runner/entrypoint.sh +++ b/gosec-runner/entrypoint.sh @@ -27,7 +27,7 @@ LATEST_VERSION=$(curl -s https://api.github.com/repos/securego/gosec/releases/la curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $LATEST_VERSION echo "run gosec command: $(go env GOPATH)/bin/gosec $EXCLUDE_FLAG $EXCLUDE_DIR_FLAG $DIRECTORIES" -$(go env GOPATH)/bin/gosec $EXCLUDE_FLAG $EXCLUDE_DIR_FLAG $DIRECTORIES +$(go env GOPATH)/bin/gosec -exclude-generated $EXCLUDE_FLAG $EXCLUDE_DIR_FLAG $DIRECTORIES TEST_RETURN_CODE=$? if [ "${TEST_RETURN_CODE}" != "0" ]; then From 79bd76b683cf45267e8c0dd0a71ec079e2363c6a Mon Sep 17 00:00:00 2001 From: Fernando Alfaro Campos Date: Wed, 19 Mar 2025 09:57:57 -0400 Subject: [PATCH 2/2] Address PR comments --- gosec-runner/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gosec-runner/entrypoint.sh b/gosec-runner/entrypoint.sh index 524fc3c3..6ef67377 100755 --- a/gosec-runner/entrypoint.sh +++ b/gosec-runner/entrypoint.sh @@ -26,7 +26,7 @@ fi LATEST_VERSION=$(curl -s https://api.github.com/repos/securego/gosec/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $LATEST_VERSION -echo "run gosec command: $(go env GOPATH)/bin/gosec $EXCLUDE_FLAG $EXCLUDE_DIR_FLAG $DIRECTORIES" +echo "run gosec command: $(go env GOPATH)/bin/gosec -exclude-generated $EXCLUDE_FLAG $EXCLUDE_DIR_FLAG $DIRECTORIES" $(go env GOPATH)/bin/gosec -exclude-generated $EXCLUDE_FLAG $EXCLUDE_DIR_FLAG $DIRECTORIES TEST_RETURN_CODE=$?