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

chore: use gitleaks for secret scanning #610

Merged
merged 11 commits into from
Sep 4, 2024
Merged
20 changes: 20 additions & 0 deletions .github/workflows/secret-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: secret-scan
on:
pull_request:
push:
workflow_dispatch:
schedule:
- cron: "0 13 * * *" # run once a day at 13:00 UTC
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
GITLEAKS_NOTIFY_USER_LIST: ${{ vars.GITLEAKS_NOTIFY_USER_LIST }}
14 changes: 14 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
f0b67e93831d16b7f6618632ad44d718c8318b87:sftp/testdata/ssh/test_key:private-key:1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged a PR a while back to remove these. Are you sure some of these lines are still relevant? Last time I removed all the RSA keys. Of course it will still complain about the certificates though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still part of git history, running secret scanning on the latest didn't detect anything. The work to remove RSA keys is still important to avoid false positives moving forward.

00cba9dbb04b6ff9807dcf6a3d2a35acf8137b49:kafkaclient/testdata/client.key.pem:private-key:1
00cba9dbb04b6ff9807dcf6a3d2a35acf8137b49:kafkaclient/testdata/ssh/test_key:private-key:1
00cba9dbb04b6ff9807dcf6a3d2a35acf8137b49:kafkaclient/testdata/truststore/ca-key:private-key:1
00cba9dbb04b6ff9807dcf6a3d2a35acf8137b49:testhelper/docker/resource/kafka/testdata/truststore/ca-key:private-key:1
00cba9dbb04b6ff9807dcf6a3d2a35acf8137b49:testhelper/docker/resource/sshserver/testdata/test_key:private-key:1
00cba9dbb04b6ff9807dcf6a3d2a35acf8137b49:testhelper/docker/resource/kafka/testdata/ssh/test_key:private-key:1
fd02c1d3a32acfada23245a824d9238c9b5f9529:broker/kafka/testdata/client.key.pem:private-key:1
fd02c1d3a32acfada23245a824d9238c9b5f9529:broker/kafka/testdata/ssh/test_key:private-key:1
fd02c1d3a32acfada23245a824d9238c9b5f9529:broker/kafka/testdata/truststore/ca-key:private-key:1
1dfc4115034e1b34fc9c1fa9d42ed61453092a89:testhelper/docker/resource/kafka/testdata/ssh/test_key:private-key:1
98130e63de7c036b800977e694f8d2d7561f41d6:testhelper/docker/resource/kafka/testdata/truststore/ca-key:private-key:1
2820fe4afd587f69d9d43b4e2724998e063b8c82:testhelper/docker/resource/sshserver/testdata/test_key:private-key:1
c7b2e4ae3cde679f36228101162a8a63ac91e576:test_git_leaks_ci.txt:generic-api-key:1
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mockgen=go.uber.org/mock/[email protected]
gotestsum=gotest.tools/[email protected]
protoc-gen-go=google.golang.org/protobuf/cmd/[email protected]
protoc-gen-go-grpc=google.golang.org/grpc/cmd/[email protected]
gitleaks=github.com/zricethezav/gitleaks/[email protected]

default: lint

Expand Down Expand Up @@ -72,6 +73,12 @@ install-tools:
.PHONY: lint
lint: fmt ## Run linters on all go files
$(GO) run $(GOLANGCI) run -v
@$(MAKE) sec

.PHONY: sec
sec: ## Run security checks
$(GO) run $(gitleaks) detect .
$(GO) run $(govulncheck) ./...

.PHONY: fmt
fmt: install-tools ## Formats all go files
Expand Down
Loading