Skip to content

Commit 24b5a38

Browse files
authored
chore(security): Support Go Vulnerability Management (#21139)
See https://go.dev/security/vuln/ Signed-off-by: Bo-Yi.Wu <[email protected]> Signed-off-by: Bo-Yi.Wu <[email protected]>
1 parent 77c916f commit 24b5a38

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.drone.yml

+10
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ steps:
3939
- make lint-frontend
4040
depends_on: [deps-frontend]
4141

42+
- name: security-check
43+
image: golang:1.19
44+
pull: always
45+
commands:
46+
- make security-check
47+
depends_on: [deps-backend]
48+
volumes:
49+
- name: deps
50+
path: /go
51+
4252
- name: lint-backend
4353
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
4454
pull: always

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/[email protected]
3535
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]
3636
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3737
GO_LICENSES_PACKAGE ?= github.com/google/[email protected]
38+
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest
3839

3940
DOCKER_IMAGE ?= gitea/gitea
4041
DOCKER_TAG ?= latest
@@ -728,6 +729,10 @@ generate-go: $(TAGS_PREREQ)
728729
@echo "Running go generate..."
729730
@CC= GOOS= GOARCH= $(GO) generate -tags '$(TAGS)' $(GO_PACKAGES)
730731

732+
.PHONY: security-check
733+
security-check:
734+
govulncheck -v ./...
735+
731736
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
732737
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
733738

@@ -813,6 +818,7 @@ deps-backend:
813818
$(GO) install $(SWAGGER_PACKAGE)
814819
$(GO) install $(XGO_PACKAGE)
815820
$(GO) install $(GO_LICENSES_PACKAGE)
821+
$(GO) install $(GOVULNCHECK_PACKAGE)
816822

817823
node_modules: package-lock.json
818824
npm install --no-save

0 commit comments

Comments
 (0)