Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable gosec for static application security testing #272

Merged
merged 5 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .ci/pipeline_definitions
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ gardener-extension-registry-cache:
attribute: global.image.tag

base_definition:
repo:
source_labels:
- name: cloud.gardener.cnudie/dso/scanning-hints/source_analysis/v1
value:
policy: skip
comment: |
We use gosec for sast scanning, see attached log.
traits:
version:
preprocess: 'inject-commit-hash'
Expand Down Expand Up @@ -79,6 +86,16 @@ gardener-extension-registry-cache:
nextversion: 'bump_minor'
next_version_callback: '.ci/prepare_release'
release_callback: '.ci/prepare_release'
assets:
- type: build-step-log
step_name: verify
purposes:
- lint
- sast
- gosec
comment: |
We use gosec (linter) for SAST scans, see: https://github.com/securego/gosec.
Enabled by https://github.com/gardener/gardener-extension-registry-cache/pull/272
slack:
default_channel: 'internal_scp_workspace'
channel_cfgs:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ TODO
.go-version

/gardener

# gosec
gosec-report.sarif
Kostov6 marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ generate-in-docker:
format: $(GOIMPORTS) $(GOIMPORTSREVISER)
@bash $(GARDENER_HACK_DIR)/format.sh ./cmd ./pkg ./test

.PHONY: sast
ialidzhikov marked this conversation as resolved.
Show resolved Hide resolved
sast: $(GOSEC)
@bash $(GARDENER_HACK_DIR)/sast.sh --exclude-dirs hack,gardener

.PHONY: sast-report
sast-report: $(GOSEC)
@bash $(GARDENER_HACK_DIR)/sast.sh --exclude-dirs hack,gardener --gosec-report true

.PHONY: test
test:
@bash $(GARDENER_HACK_DIR)/test.sh ./cmd/... ./pkg/...
Expand All @@ -103,10 +111,10 @@ test-clean:
@bash $(GARDENER_HACK_DIR)/test-cover-clean.sh

.PHONY: verify
verify: check format test
verify: check format test sast

.PHONY: verify-extended
verify-extended: check-generate check format test-cov test-clean
verify-extended: check-generate check format test-cov test-clean sast-report

test-e2e-local: $(GINKGO)
./hack/test-e2e-local.sh --procs=$(PARALLEL_E2E_TESTS) ./test/e2e/...
Expand Down