Skip to content

Commit

Permalink
feat: add semgrep to makefile & fix it's rules
Browse files Browse the repository at this point in the history
  • Loading branch information
belokobylskii.i committed Oct 18, 2024
1 parent e6b2c71 commit bbb657e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/secure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
security-events: write
steps:
- uses: actions/checkout@v4
- run: semgrep scan --sarif --output=semgrep.sarif --error --severity=WARNING
- run: semgrep scan --sarif --output=semgrep.sarif --error --severity=WARNING --severity=ERROR
env:
SEMGREP_RULES: >-
p/command-injection
Expand Down
1 change: 1 addition & 0 deletions .semgrepignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
website/
*_test.go
25 changes: 24 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,27 @@ ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
endif
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)

.PHONY: golangci-lint build test testacc fmt test-compile website website-test

# CLI reference:
# https://semgrep.dev/docs/cli-reference
semgrep:
docker run --rm -v ${PWD}:/app:ro -w /app semgrep/semgrep semgrep scan --error --metrics=off \
--config=p/command-injection \
--config=p/comment \
--config=p/cwe-top-25 \
--config=p/default \
--config=p/gitleaks \
--config=p/golang \
--config=p/gosec \
--config=p/insecure-transport \
--config=p/owasp-top-ten \
--config=p/r2c-best-practices \
--config=p/r2c-bug-scan \
--config=p/r2c-security-audit \
--config=p/secrets \
--config=p/security-audit \
--config=p/sql-injection \
--config=p/xss \
.

.PHONY: golangci-lint build test testacc fmt test-compile semgrep website website-test
3 changes: 1 addition & 2 deletions selectel/dbaas.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package selectel

//nolint:gci
import ( // nosemgrep: gitlab.gosec.G501-1
import (
"context"
"crypto/md5"
"errors"
Expand Down

0 comments on commit bbb657e

Please sign in to comment.