Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
update docs and support multi platform docker images
Dustin Deckera96de1a2cd8d
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 76c7c8485..264268301 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -1,30 +1,47 @@name: release+# on:+# push:+# tags:+# - 'v*'+on:push:tags:- - 'v*'+ - v*+ branches:+ - main+ pull_request:++permissions:+ contents: writejobs:- goreleaser:+ Release:runs-on: ubuntu-latest+ env:+ DOCKER_CLI_EXPERIMENTAL: "enabled"steps:- -- name: Checkout+ - name: Checkoutuses: actions/checkout@v2with:fetch-depth: 0- -- name: Set up Go+ - name: Set up QEMU+ uses: docker/setup-qemu-action@v1+ - name: Docker Login+ uses: docker/login-action@v1+ with:+ registry: ghcr.io+ username: ${{ github.repository_owner }}+ password: ${{ secrets.GITHUB_TOKEN }}+ - name: Set up Gouses: actions/setup-go@v2with:go-version: 1.17- -- name: Run GoReleaser+ - name: Run GoReleaseruses: goreleaser/goreleaser-action@v2with:- distribution: goreleaserversion: latestargs: release --rm-distenv:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\ No newline at end of filediff --git a/.gitignore b/.gitignoreindex 485dee64b..dc621d0e2 100644--- a/.gitignore+++ b/.gitignore@@ -1 +1,2 @@.idea+distdiff --git a/.goreleaser.yml b/.goreleaser.ymlnew file mode 100644index 000000000..2ba53f5a6--- /dev/null+++ b/.goreleaser.yml@@ -0,0 +1,45 @@+builds:+- env: [CGO_ENABLED=0]+ binary: trufflehog+ goos:+ - linux+ - windows+ - darwin+ goarch:+ - amd64+ - arm64+dockers:+- image_templates: ["ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64"]+ dockerfile: Dockerfile.goreleaser+ use: buildx+ build_flag_templates:+ - --platform=linux/amd64+ - --label=org.opencontainers.image.title={{ .ProjectName }}+ - --label=org.opencontainers.image.description={{ .ProjectName }}+ - --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}+ - --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}+ - --label=org.opencontainers.image.version={{ .Version }}+ - --label=org.opencontainers.image.revision={{ .FullCommit }}+ - --label=org.opencontainers.image.licenses=AGPL-3.0+- image_templates: ["ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8"]+ goarch: arm64+ dockerfile: Dockerfile.goreleaser+ use: buildx+ build_flag_templates:+ - --platform=linux/arm64/v8+ - --label=org.opencontainers.image.title={{ .ProjectName }}+ - --label=org.opencontainers.image.description={{ .ProjectName }}+ - --label=org.opencontainers.image.url=https://github.com/trufflesecurity/{{ .ProjectName }}+ - --label=org.opencontainers.image.source=https://github.com/trufflesecurity/{{ .ProjectName }}+ - --label=org.opencontainers.image.version={{ .Version }}+ - --label=org.opencontainers.image.revision={{ .FullCommit }}+ - --label=org.opencontainers.image.licenses=AGPL-3.0+docker_manifests:+- name_template: ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}+ image_templates:+ - ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64+ - ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8+- name_template: ghcr.io/trufflesecurity/{{ .ProjectName }}:latest+ image_templates:+ - ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-amd64+ - ghcr.io/trufflesecurity/{{ .ProjectName }}:{{ .Version }}-arm64v8\ No newline at end of filediff --git a/Dockerfile.goreleaser b/Dockerfile.goreleasernew file mode 100644index 000000000..a9bda863c--- /dev/null+++ b/Dockerfile.goreleaser@@ -0,0 +1,6 @@+FROM golang:bullseye as builder++FROM scratch+COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt+COPY trufflehog /usr/bin/trufflehog+ENTRYPOINT ["/usr/bin/trufflehog"]\ No newline at end of filediff --git a/README.md b/README.mdindex 3818d5d11..372287a2d 100644--- a/README.md+++ b/README.md@@ -1,6 +1,11 @@# TruffleHog-# Join The Slack+[](https://github.com/trufflesecurity/trufflehog2/actions)+[](https://goreportcard.com/report/github.com/trufflesecurity/trufflehog2)+[](https://hub.docker.com/r/trufflesecurity/trufflehog2/)+++## Join The SlackHave questions? Feedback? Jump in slack and hang out with ushttps://join.slack.com/t/trufflehog-community/shared_invite/zt-pw2qbi43-Aa86hkiimstfdKH9UCpPzQ@@ -14,8 +19,28 @@ Several options:### 2. [Release binaries](https://github.com/trufflesecurity/trufflehog2/releases)-### 3. Docker (TODO)-`docker run ...`+### 3. Docker+```bash+$ docker run -v "$PWD:/pwd" ghcr.io/trufflesecurity/trufflehog2:latest github --repo https://github.com/dustin-decker/secretsandstuff.git+π·ππ· TruffleHog. Unearth your secrets. π·ππ·++Found verified result π·π+Detector Type: AWS+File: aws+Link: https://github.com/dustin-decker/secretsandstuff/blob/90c75f884c65dc3638ca1610bd9844e668f213c2/aws+Repository: https://github.com/dustin-decker/secretsandstuff.git+Commit: 90c75f884c65dc3638ca1610bd9844e668f213c2+Email: [email protected]++Found unverified result π·πβ+Detector Type: Github+File: slack+Link: https://github.com/dustin-decker/secretsandstuff/blob/8afb0ecd4998b1179e428db5ebbcdc8221214432/slack+Repository: https://github.com/dustin-decker/secretsandstuff.git+Commit: 8afb0ecd4998b1179e428db5ebbcdc8221214432+Email: [email protected]+...+```### 4. Pip (TODO)pip install trufflehogdiff --git a/pkg/engine/git.go b/pkg/engine/git.goindex 9f4c003e8..f0f64d16a 100644--- a/pkg/engine/git.go+++ b/pkg/engine/git.go@@ -3,9 +3,10 @@ package engineimport ("context""fmt"- "github.com/go-git/go-git/v5/plumbing/object""runtime"+ "github.com/go-git/go-git/v5/plumbing/object"+gogit "github.com/go-git/go-git/v5""github.com/go-git/go-git/v5/plumbing""github.com/sirupsen/logrus"