Skip to content

Commit f7f08e6

Browse files
committed
Merge branch 'hackathon/detector-tests-in-ci' of mustansir:trufflesecurity/trufflehog into hackathon/detector-tests-in-ci
2 parents 88c63e6 + c53fbcb commit f7f08e6

36 files changed

Lines changed: 868 additions & 84 deletions

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v4
41+
uses: actions/checkout@v6
4242
- name: Install Go
43-
uses: actions/setup-go@v5
43+
uses: actions/setup-go@v6
4444
with:
4545
go-version: "1.25"
4646
# Initializes the CodeQL tools for scanning.
4747
- name: Initialize CodeQL
48-
uses: github/codeql-action/init@v3
48+
uses: github/codeql-action/init@v4
4949
with:
5050
languages: ${{ matrix.language }}
5151
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -56,4 +56,4 @@ jobs:
5656
run: |
5757
go build .
5858
- name: Perform CodeQL Analysis
59-
uses: github/codeql-action/analyze@v3
59+
uses: github/codeql-action/analyze@v4

.github/workflows/detector-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
contents: "read"
1515
id-token: "write"
1616
steps:
17-
- uses: actions/checkout@v4
18-
- uses: actions/setup-go@v5
17+
- uses: actions/checkout@v6
18+
- uses: actions/setup-go@v6
1919
- name: Install gotestsum
20-
uses: jaxxstorm/action-install-gh-release@v1.14.0
20+
uses: jaxxstorm/action-install-gh-release@v3.0.0 # immutable release; no rolling @v3 tag
2121
with:
2222
repo: gotestyourself/gotestsum
2323
- uses: rwx-research/setup-captain@v1

.github/workflows/lint.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
name: golangci-lint
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v4
19-
- uses: actions/setup-go@v5
18+
- uses: actions/checkout@v6
19+
- uses: actions/setup-go@v6
2020
with:
2121
go-version: "1.25"
2222
- name: golangci-lint
23-
uses: golangci/golangci-lint-action@v7
23+
uses: golangci/golangci-lint-action@v9
2424
with:
2525
# NOTE: Version and args must match scripts/lint.sh
2626
version: v2.11.4
@@ -29,8 +29,8 @@ jobs:
2929
name: man-page-staleness
3030
runs-on: ubuntu-latest
3131
steps:
32-
- uses: actions/checkout@v4
33-
- uses: actions/setup-go@v5
32+
- uses: actions/checkout@v6
33+
- uses: actions/setup-go@v6
3434
with:
3535
go-version: "1.25"
3636
- name: Regenerate man page
@@ -48,16 +48,16 @@ jobs:
4848
image: returntocorp/semgrep
4949
if: (github.actor != 'dependabot[bot]')
5050
steps:
51-
- uses: actions/checkout@v4
51+
- uses: actions/checkout@v6
5252
- run: semgrep --config=hack/semgrep-rules/detectors.yaml pkg/detectors/
5353
checksecretparts:
5454
# Reports detector packages that construct detectors.Result without
5555
# populating SecretParts. See hack/checksecretparts/README.md.
5656
name: checksecretparts
5757
runs-on: ubuntu-latest
5858
steps:
59-
- uses: actions/checkout@v4
60-
- uses: actions/setup-go@v5
59+
- uses: actions/checkout@v6
60+
- uses: actions/setup-go@v6
6161
with:
6262
go-version: "1.25"
6363
- name: Run checksecretparts

.github/workflows/performance.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v6
1515
with:
1616
fetch-depth: 0
1717
ref: ${{ github.head_ref }}
1818

1919
- name: Install Go
20-
uses: actions/setup-go@v5
20+
uses: actions/setup-go@v6
2121
with:
2222
go-version: "1.25"
2323

@@ -54,7 +54,7 @@ jobs:
5454
echo PREVIOUS_TAG=$(cat previous_tag.txt) >> $GITHUB_ENV
5555
5656
- name: Checkout code
57-
uses: actions/checkout@v4
57+
uses: actions/checkout@v6
5858
with:
5959
fetch-depth: 0
6060
ref: ${{ env.PREVIOUS_TAG }}

.github/workflows/release-bot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414
steps:
1515
- name: Login to GCP
1616
id: auth
17-
uses: "google-github-actions/auth@v2"
17+
uses: "google-github-actions/auth@v3"
1818
with:
1919
credentials_json: ${{ secrets.GCP_SA_TRUFFLE_RELEASE_BOT }}
2020

2121
- name: Login to GAR
22-
uses: docker/login-action@v3
22+
uses: docker/login-action@v4
2323
with:
2424
registry: us-central1-docker.pkg.dev
2525
username: _json_key

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ jobs:
1818
steps:
1919
# Setup steps - no external side effects.
2020
- name: Checkout
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v6
2222
with:
2323
fetch-depth: 0
2424
- name: Set up QEMU
25-
uses: docker/setup-qemu-action@v3
25+
uses: docker/setup-qemu-action@v4
2626
- name: Docker Login to DockerHub
27-
uses: docker/login-action@v3
27+
uses: docker/login-action@v4
2828
with:
2929
username: ${{ secrets.DOCKERHUB_USERNAME }}
3030
password: ${{ secrets.DOCKERHUB_TOKEN }}
3131
- name: Docker Login to GitHub Container Registry
32-
uses: docker/login-action@v3
32+
uses: docker/login-action@v4
3333
with:
3434
registry: ghcr.io
3535
username: ${{ github.repository_owner }}
3636
password: ${{ secrets.GITHUB_TOKEN }}
3737
- name: Set up Go
38-
uses: actions/setup-go@v5
38+
uses: actions/setup-go@v6
3939
with:
4040
go-version: "1.25"
4141
- name: Cosign install
@@ -64,7 +64,7 @@ jobs:
6464
# version. The release is NOT marked latest (make_latest: false), so
6565
# /releases/latest still points to the previous good release.
6666
- name: Run GoReleaser
67-
uses: goreleaser/goreleaser-action@v6
67+
uses: goreleaser/goreleaser-action@v7
6868
with:
6969
distribution: goreleaser-pro
7070
version: latest

.github/workflows/secrets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
with:
2020
fetch-depth: 0
2121
ref: ${{ github.head_ref }}

.github/workflows/smoke.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v4
11+
uses: actions/checkout@v6
1212
- name: Install Go
13-
uses: actions/setup-go@v5
13+
uses: actions/setup-go@v6
1414
with:
1515
go-version: "1.25"
1616
- name: Smoke
@@ -23,9 +23,9 @@ jobs:
2323
timeout-minutes: 5
2424
steps:
2525
- name: Checkout code
26-
uses: actions/checkout@v4
26+
uses: actions/checkout@v6
2727
- name: Install Go
28-
uses: actions/setup-go@v5
28+
uses: actions/setup-go@v6
2929
with:
3030
go-version: "1.25"
3131
- name: Run trufflehog

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ jobs:
1818
id-token: "write"
1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v6
2222
- name: Install Go
23-
uses: actions/setup-go@v5
23+
uses: actions/setup-go@v6
2424
with:
2525
go-version: "1.25"
2626
- id: "auth"
27-
uses: "google-github-actions/auth@v2"
27+
uses: "google-github-actions/auth@v3"
2828
with:
2929
workload_identity_provider: "projects/811013774421/locations/global/workloadIdentityPools/github-pool/providers/github-provider"
3030
service_account: "github-ci-external@trufflehog-testing.iam.gserviceaccount.com"
@@ -48,7 +48,7 @@ jobs:
4848
secret: ${{ secrets.BUILDPULSE_SECRET_ACCESS_KEY }}
4949
tags: integration
5050
- name: Annotate test results
51-
uses: mikepenz/action-junit-report@v5
51+
uses: mikepenz/action-junit-report@v6
5252
if: success() || failure() # always run even if the previous step fails
5353
with:
5454
report_paths: "tmp/test-results/*.xml"
@@ -60,9 +60,9 @@ jobs:
6060
contents: "read"
6161
steps:
6262
- name: Checkout code
63-
uses: actions/checkout@v4
63+
uses: actions/checkout@v6
6464
- name: Install Go
65-
uses: actions/setup-go@v5
65+
uses: actions/setup-go@v6
6666
with:
6767
go-version: "1.25"
6868
- name: Test

pkg/detectors/cliengo/cliengo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type Scanner struct{}
1818
var _ detectors.Detector = (*Scanner)(nil)
1919

2020
var (
21-
client = common.SaneHttpClient()
21+
client = detectors.NewClientWithDedup(common.SaneHttpClient())
2222

2323
// Make sure that your group is surrounded in boundary characters such as below to reduce false positives.
2424
keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"cliengo"}) + `\b([0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12})\b`)
@@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
5050
if err != nil {
5151
continue
5252
}
53-
res, err := client.Do(req)
53+
res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_Cliengo, resMatch, req)
5454
if err == nil {
5555
defer res.Body.Close()
5656
if res.StatusCode >= 200 && res.StatusCode < 300 {

0 commit comments

Comments
 (0)