Skip to content

Find, verify, and analyze leaked credentials

Use go 1.22 (#2599)

Dustin Decker41d58739bd32
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 40077dc16..ab6c60738 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -13,12 +13,12 @@ name: "CodeQL"
on:
push:
- branches: [ main ]
+ branches: [main]
pull_request:
# The branches below must be a subset of the branches above
- branches: [ main ]
+ branches: [main]
schedule:
- - cron: '35 11 * * 2'
+ - cron: "35 11 * * 2"
jobs:
analyze:
@@ -32,39 +32,29 @@ jobs:
strategy:
fail-fast: false
matrix:
- language: [ 'go' ]
+ language: ["go"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- - name: Checkout repository
- uses: actions/checkout@v4
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v3
- with:
- languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
- # queries: ./path/to/local/query, your-org/your-repo/queries@main
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v3
-
- # ℹ️ Command-line programs to run using the OS shell.
- # 📚 https://git.io/JvXDl
-
- # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
- # and modify them (or add more) to build your code if your project
- # uses a compiled language
-
- #- run: |
- # make bootstrap
- # make release
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v3
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v3
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
+ - name: Install Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: "1.22"
+ - name: Smoke
+ run: |
+ go build .
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v3
diff --git a/.github/workflows/detector-tests.yml b/.github/workflows/detector-tests.yml
index 11e95dd07..361737f66 100644
--- a/.github/workflows/detector-tests.yml
+++ b/.github/workflows/detector-tests.yml
@@ -17,7 +17,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
- go-version: "1.21"
+ go-version: "1.22"
- name: Checkout code
uses: actions/checkout@v4
- id: "auth"
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 8f6aa6fd0..bb82778b9 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
- go-version: "1.21"
+ go-version: "1.22"
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml
index 0aae0605d..76fef6288 100644
--- a/.github/workflows/performance.yml
+++ b/.github/workflows/performance.yml
@@ -10,83 +10,83 @@ jobs:
runs-on: ubuntu-latest
steps:
- - name: Install Go
- uses: actions/setup-go@v5
- with:
- go-version: '1.21'
-
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.head_ref }}
-
- - name: Run Head
- run: |
- go build -o current .
- repo_tmp=$(mktemp -d)
- git clone https://github.com/trufflesecurity/trufflehog.git $repo_tmp
-
- user_time_sum=0
-
- for i in {1..5}
- do
- tmpfile=$(mktemp)
- /usr/bin/time -o $tmpfile $GITHUB_WORKSPACE/current git "file://$repo_tmp" --no-verification --no-update > out.txt
- cat $tmpfile
- time_output=$(cat $tmpfile)
- rm $tmpfile
- user_time=$(echo $time_output | awk '{print $1}' | sed 's/user//')
-
- # Add the user time to the sum
- user_time_sum=$(echo "$user_time_sum + $user_time" | bc)
- done
-
- average_user_time=$(echo "scale=3; $user_time_sum / 5" | bc)
- echo HEAD_TIME=$average_user_time >> $GITHUB_ENV
-
- - name: Figure out previous tag
- run: |
- git fetch --tags
- git tag -l --sort=-v:refname | head -n 1 > previous_tag.txt
- echo PREVIOUS_TAG=$(cat previous_tag.txt) >> $GITHUB_ENV
-
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ env.PREVIOUS_TAG }}
-
- - name: Run Previous
- run: |
- go build -o previous .
- repo_tmp=$(mktemp -d)
- git clone https://github.com/trufflesecurity/trufflehog.git $repo_tmp
-
- user_time_sum=0
-
- for i in {1..5}
- do
- tmpfile=$(mktemp)
- /usr/bin/time -o $tmpfile $GITHUB_WORKSPACE/previous git "file://$repo_tmp" --no-verification --no-update > out.txt
- cat $tmpfile
- time_output=$(cat $tmpfile)
- rm $tmpfile
- user_time=$(echo $time_output | awk '{print $1}' | sed 's/user//')
-
- # Add the user time to the sum
- user_time_sum=$(echo "$user_time_sum + $user_time" | bc)
- done
-
- average_user_time=$(echo "scale=3; $user_time_sum / 5" | bc)
- echo PREVIOUS_TIME=$average_user_time >> $GITHUB_ENV
-
- - name: Compare Results
- run: |
- echo "head ($GITHUB_SHA) avg time (n=5): $HEAD_TIME"
- echo "$PREVIOUS_TAG avg time (n=5): $PREVIOUS_TIME"
- if [ $(echo "$HEAD_TIME > $PREVIOUS_TIME * 1.1" | bc) -eq 1 ]
- then
- echo "HEAD run time is at least 10% slower than PREVIOUS run time"
- exit 1
- fi
+ - name: Install Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: "1.22"
+
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ ref: ${{ github.head_ref }}
+
+ - name: Run Head
+ run: |
+ go build -o current .
+ repo_tmp=$(mktemp -d)
+ git clone https://github.com/trufflesecurity/trufflehog.git $repo_tmp
+
+ user_time_sum=0
+
+ for i in {1..5}
+ do
+ tmpfile=$(mktemp)
+ /usr/bin/time -o $tmpfile $GITHUB_WORKSPACE/current git "file://$repo_tmp" --no-verification --no-update > out.txt
+ cat $tmpfile
+ time_output=$(cat $tmpfile)
+ rm $tmpfile
+ user_time=$(echo $time_output | awk '{print $1}' | sed 's/user//')
+
+ # Add the user time to the sum
+ user_time_sum=$(echo "$user_time_sum + $user_time" | bc)
+ done
+
+ average_user_time=$(echo "scale=3; $user_time_sum / 5" | bc)
+ echo HEAD_TIME=$average_user_time >> $GITHUB_ENV
+
+ - name: Figure out previous tag
+ run: |
+ git fetch --tags
+ git tag -l --sort=-v:refname | head -n 1 > previous_tag.txt
+ echo PREVIOUS_TAG=$(cat previous_tag.txt) >> $GITHUB_ENV
+
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ ref: ${{ env.PREVIOUS_TAG }}
+
+ - name: Run Previous
+ run: |
+ go build -o previous .
+ repo_tmp=$(mktemp -d)
+ git clone https://github.com/trufflesecurity/trufflehog.git $repo_tmp
+
+ user_time_sum=0
+
+ for i in {1..5}
+ do
+ tmpfile=$(mktemp)
+ /usr/bin/time -o $tmpfile $GITHUB_WORKSPACE/previous git "file://$repo_tmp" --no-verification --no-update > out.txt
+ cat $tmpfile
+ time_output=$(cat $tmpfile)
+ rm $tmpfile
+ user_time=$(echo $time_output | awk '{print $1}' | sed 's/user//')
+
+ # Add the user time to the sum
+ user_time_sum=$(echo "$user_time_sum + $user_time" | bc)
+ done
+
+ average_user_time=$(echo "scale=3; $user_time_sum / 5" | bc)
+ echo PREVIOUS_TIME=$average_user_time >> $GITHUB_ENV
+
+ - name: Compare Results
+ run: |
+ echo "head ($GITHUB_SHA) avg time (n=5): $HEAD_TIME"
+ echo "$PREVIOUS_TAG avg time (n=5): $PREVIOUS_TIME"
+ if [ $(echo "$HEAD_TIME > $PREVIOUS_TIME * 1.1" | bc) -eq 1 ]
+ then
+ echo "HEAD run time is at least 10% slower than PREVIOUS run time"
+ exit 1
+ fi
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f6d833c4e..b94e5a0c3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -36,7 +36,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
- go-version: '1.21'
+ go-version: "1.22"
- name: Cosign install
uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 # v3.4.0
- name: Run GoReleaser
diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml
index d96e8d8f4..df89612fb 100644
--- a/.github/workflows/smoke.yml
+++ b/.github/workflows/smoke.yml
@@ -1,4 +1,3 @@
-
name: Smoke
on:
@@ -8,14 +7,14 @@ jobs:
smoke:
runs-on: ubuntu-latest
steps:
- - name: Install Go
- uses: actions/setup-go@v5
- with:
- go-version: '1.21'
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Smoke
- run: |
- set -e
- go run . git https://github.com/dustin-decker/secretsandstuff.git
- go run . github --repo https://github.com/dustin-decker/secretsandstuff.git
+ - name: Install Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: "1.22"
+ - name: Checkout code
+ uses: actions/checkout@v4
+ - name: Smoke
+ run: |
+ set -e
+ go run . git https://github.com/dustin-decker/secretsandstuff.git
+ go run . github --repo https://github.com/dustin-decker/secretsandstuff.git
diff --git a/.github/workflows/snifftest.yml b/.github/workflows/snifftest.yml
index afa25aca5..a3dddb4b6 100644
--- a/.github/workflows/snifftest.yml
+++ b/.github/workflows/snifftest.yml
@@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
- go-version: '1.21'
+ go-version: "1.22"
- uses: actions/checkout@v4
- name: Run Snifftest
run: make snifftest
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index d2501d611..83edb8d94 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -20,7 +20,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
- go-version: "1.21"
+ go-version: "1.22"
- name: Checkout code
uses: actions/checkout@v4
- id: "auth"
@@ -62,7 +62,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
- go-version: "1.21"
+ go-version: "1.22"
- name: Checkout code
uses: actions/checkout@v4
- name: Test
diff --git a/Makefile b/Makefile
index 08faf6be9..917881c47 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-PROTOS_IMAGE ?= trufflesecurity/protos:1.21-1
+PROTOS_IMAGE ?= trufflesecurity/protos:1.22
.PHONY: check
.PHONY: lint
@@ -59,7 +59,7 @@ protos-windows:
release-protos-image:
docker buildx build --push --platform=linux/amd64,linux/arm64 \
- -t trufflesecurity/protos:1.21-1 -f hack/Dockerfile.protos .
+ -t ${PROTOS_IMAGE} -f hack/Dockerfile.protos .
snifftest:
./hack/snifftest/snifftest.sh
diff --git a/go.mod b/go.mod
index eaeea9266..910ed324d 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/trufflesecurity/trufflehog/v3
-go 1.21
+go 1.22
replace github.com/jpillora/overseer => github.com/trufflesecurity/overseer v1.2.7
diff --git a/hack/Dockerfile.protos b/hack/Dockerfile.protos
index f854ac12e..0a42c5f2a 100644
--- a/hack/Dockerfile.protos
+++ b/hack/Dockerfile.protos
@@ -1,24 +1,35 @@
-# trufflesecurity/protos:1.18-0
+# trufflesecurity/protos:1.22
FROM golang:1.22-bullseye
ARG TARGETARCH
ARG TARGETOS
-ENV PROTOC_VER=3.20.0
-ENV GORELEASER_VER=v1.7.0
-ENV SQLBOILER_VER=v4.9.0
-ENV PROTOC_GEN_GO_VER=v1.5.2
+
+ENV PROTOC_VER=25.3
+ENV PROTOC_GEN_GO_VER=v1.5.4
+ENV PROTOC_GEN_VALIDATE_VER=v1.0.4
+ENV GORELEASER_VERSION=1.19.2
RUN echo "building $TARGETARCH"
-RUN apt-get update; apt-get install -y --no-install-recommends git unzip && rm -rf /var/lib/apt/lists/*
+RUN go install github.com/dustin-decker/quill/cmd/[email protected]
+RUN apt-get update; apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y; \
+ curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
+ $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null; \
+ apt-get update; apt-get install -y --no-install-recommends python3-pip docker-ce-cli docker-buildx-plugin docker-compose-plugin \
+ git netbase wget upx unzip && rm -rf /var/lib/apt/lists/*
+RUN pip3 install --upgrade setuptools pip
RUN set -e; \
arch=$(echo $TARGETARCH | sed -e s/amd64/x86_64/ -e s/arm64/aarch_64/); \
wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-${TARGETOS}-${arch}.zip && unzip protoc-${PROTOC_VER}-${TARGETOS}-${arch}.zip -d /usr/local
+RUN curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -; echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list; apt-get update; apt-get install -y google-cloud-cli
+RUN echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list; \
+ apt-get update; apt-get install -y goreleaser=${GORELEASER_VERSION} && rm -rf /var/lib/apt/lists/*
RUN go install "github.com/golang/protobuf/protoc-gen-go@${PROTOC_GEN_GO_VER}"
-RUN GO111MODULE=off go get -d "github.com/envoyproxy/protoc-gen-validate" && \
+RUN go install gotest.tools/gotestsum@latest
+RUN git clone https://github.com/envoyproxy/protoc-gen-validate $GOPATH/src/github.com/envoyproxy/protoc-gen-validate && \
cd $GOPATH/src/github.com/envoyproxy/protoc-gen-validate && \
- git checkout v0.6.7 && \
+ git checkout ${PROTOC_GEN_VALIDATE_VER} && \
ln -s /usr/local/protoc/include/google google && \
make build
-RUN go install github.com/chrusty/protoc-gen-jsonschema/cmd/protoc-gen-jsonschema@latest
CMD ["bash"]