From 78e849608b7d47d32e3865f1213011c79ad8756b Mon Sep 17 00:00:00 2001 From: peng9808 Date: Fri, 13 Sep 2024 15:39:50 +0800 Subject: [PATCH] fix gosec some bug Signed-off-by: peng9808 --- .github/workflows/period-check.yml | 17 +++++++++++++++-- .github/workflows/pr.yml | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/period-check.yml b/.github/workflows/period-check.yml index bd5242d..325bc46 100644 --- a/.github/workflows/period-check.yml +++ b/.github/workflows/period-check.yml @@ -16,11 +16,24 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Remove old Go version + run: sudo rm -rf /usr/local/go + - name: Install Go and gosec + run: | + wget https://golang.org/dl/go1.22.7.linux-amd64.tar.gz + sudo tar -xvf go1.22.7.linux-amd64.tar.gz -C /usr/local + echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.bashrc + export PATH=$PATH:/usr/local/go/bin + go version + go install github.com/securego/gosec/v2/cmd/gosec@latest + echo "export PATH=$PATH:$(go env GOPATH)/bin" >> $HOME/.bashrc + export PATH=$PATH:$(go env GOPATH)/bin + gosec --version - name: Run gosec security scan run: | - curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s latest + export PATH=$PATH:/usr/local/go/bin:$(go env GOPATH)/bin gosec -severity high -confidence high ./... || exit 1 - name: e2e test env: E2E_TESTING_LEVEL: "periodCheck" - run: make e2e-test + run: make e2e-test \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 03feae7..3d41d27 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,9 +20,22 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Remove old Go version + run: sudo rm -rf /usr/local/go + - name: Install Go and gosec + run: | + wget https://golang.org/dl/go1.22.7.linux-amd64.tar.gz + sudo tar -xvf go1.22.7.linux-amd64.tar.gz -C /usr/local + echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.bashrc + export PATH=$PATH:/usr/local/go/bin + go version + go install github.com/securego/gosec/v2/cmd/gosec@latest + echo "export PATH=$PATH:$(go env GOPATH)/bin" >> $HOME/.bashrc + export PATH=$PATH:$(go env GOPATH)/bin + gosec --version - name: Run gosec security scan run: | - curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s latest + export PATH=$PATH:/usr/local/go/bin:$(go env GOPATH)/bin gosec -severity high -confidence high ./... || exit 1 - name: pr test env: