Skip to content

Commit ae78787

Browse files
Merge branch 'main' into feature/ins-58
2 parents daebef8 + 75056d9 commit ae78787

File tree

16 files changed

+1517
-483
lines changed

16 files changed

+1517
-483
lines changed

.github/workflows/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# GitHub Workflows
2+
3+
This directory contains GitHub Actions workflows for the TruffleHog repository.
4+
5+
## PR Approval Check (`pr-approval-check.yml`)
6+
7+
This workflow enforces that at least one PR approver must be an **active** member of the `@trufflesecurity/product-eng` team or any of its child teams.
8+
9+
### How it works:
10+
11+
1. **Triggers**: The workflow runs on:
12+
- `pull_request_review` events when a review is submitted (`submitted` type)
13+
- `pull_request` events when a PR is opened, reopened, or synchronized (`opened`, `reopened`, `synchronize` types)
14+
15+
2. **Approval Check Process**: The workflow:
16+
- Fetches all reviews for the PR using the GitHub API
17+
- Filters for reviews with state `APPROVED`
18+
- Gets all child teams of `@trufflesecurity/product-eng` using `listChildInOrg` API
19+
- Checks if any approver is an **active** member (not pending) of either:
20+
- The parent `@trufflesecurity/product-eng` team, OR
21+
- Any of its child teams
22+
- Sets a commit status accordingly
23+
24+
3. **Status Check**: Creates a commit status named `product-eng-approval` with:
25+
-**Success**: When at least one approver is an active member of `@trufflesecurity/product-eng` or any child team
26+
-**Failure**: When there are no approvals or there are approvals but none from active `@trufflesecurity/product-eng` members
27+
28+
### Error Handling
29+
30+
If there are errors listing reviews or checking team membership, the workflow reports a failure status and also fails itself.
31+
32+
### Branch Protection
33+
34+
To make this check required:
35+
36+
1. Go to Settings → Branches
37+
2. Add or edit a branch protection rule for your main branch
38+
3. Enable "Require status checks to pass before merging"
39+
4. Add `pr-approval-check` to the required status checks
40+
41+
### Permissions
42+
43+
The workflow uses the default `GITHUB_TOKEN` which has sufficient permissions to:
44+
- Read PR reviews
45+
- List child teams and check team membership (for public teams)
46+
- Create commit statuses
47+
48+
**Note**: If the `product-eng` team or its child teams are private, you may need to use a personal access token with appropriate permissions. The Github API returns 404 for non-members and for lack of permissions.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: PR Approval Check
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Receive PR"]
6+
types: ["completed"]
7+
8+
permissions:
9+
actions: read
10+
11+
jobs:
12+
approval:
13+
runs-on: ubuntu-slim
14+
steps:
15+
- name: Download artifact from triggering run
16+
uses: actions/download-artifact@v6
17+
with:
18+
run-id: ${{ github.event.workflow_run.id }}
19+
name: prnum
20+
github-token: ${{ github.token }}
21+
22+
- name: Read inputs
23+
id: get-prnum
24+
run: |
25+
set -euo pipefail
26+
echo "prnum=$(cat prnum.txt)" >> "$GITHUB_OUTPUT"
27+
28+
- name: Mint installation token
29+
id: app-token
30+
uses: actions/[email protected]
31+
with:
32+
app-id: ${{ secrets.PR_APPROVAL_CHECK_APP_ID }}
33+
private-key: ${{ secrets.PR_APPROVAL_CHECK }}
34+
35+
- name: Require Product Eng approval
36+
uses: trufflesecurity/pr-approval-check@main
37+
with:
38+
org: trufflesecurity
39+
approver_team: product-eng
40+
owner: ${{ github.event.workflow_run.repository.owner.login }}
41+
repo: ${{ github.event.workflow_run.repository.name }}
42+
head: ${{ github.event.workflow_run.head_sha }}
43+
number: ${{ steps.get-prnum.outputs.prnum }}
44+
github_token: ${{ steps.app-token.outputs.token }}
45+

.github/workflows/receive-pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Receive PR"
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
pull_request_review:
7+
types: [submitted, edited, dismissed]
8+
9+
jobs:
10+
prnum:
11+
runs-on: ubuntu-slim
12+
steps:
13+
- name: Determine PR Number
14+
id: build
15+
run: |
16+
echo "PR: ${{ github.event.pull_request.number }}"
17+
echo "${{ github.event.pull_request.number }}" > prnum.txt
18+
- name: Submit
19+
uses: actions/upload-artifact@v5
20+
with:
21+
name: prnum
22+
path: prnum.txt
23+
retention-days: 1
24+

go.mod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ require (
9191
github.com/shuheiktgw/go-travis v0.3.1
9292
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7
9393
github.com/stretchr/testify v1.10.0
94-
github.com/tailscale/depaware v0.0.0-20250112153213-b748de04d81b
9594
github.com/testcontainers/testcontainers-go v0.34.0
9695
github.com/testcontainers/testcontainers-go/modules/elasticsearch v0.34.0
9796
github.com/testcontainers/testcontainers-go/modules/mongodb v0.34.0
@@ -258,7 +257,6 @@ require (
258257
github.com/opencontainers/image-spec v1.1.1 // indirect
259258
github.com/pierrec/lz4/v4 v4.1.21 // indirect
260259
github.com/pjbgf/sha1cd v0.3.2 // indirect
261-
github.com/pkg/diff v0.0.0-20200914180035-5b29258ca4f7 // indirect
262260
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
263261
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
264262
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
@@ -312,7 +310,6 @@ require (
312310
golang.org/x/mod v0.26.0 // indirect
313311
golang.org/x/sys v0.35.0 // indirect
314312
golang.org/x/term v0.34.0 // indirect
315-
golang.org/x/tools v0.35.0 // indirect
316313
google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect
317314
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
318315
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect

go.sum

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,6 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m
584584
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
585585
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
586586
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
587-
github.com/nwaples/rardecode/v2 v2.2.0 h1:4ufPGHiNe1rYJxYfehALLjup4Ls3ck42CWwjKiOqu0A=
588-
github.com/nwaples/rardecode/v2 v2.2.0/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw=
589587
github.com/nwaples/rardecode/v2 v2.2.1 h1:DgHK/O/fkTQEKBJxBMC5d9IU8IgauifbpG78+rZJMnI=
590588
github.com/nwaples/rardecode/v2 v2.2.1/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw=
591589
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
@@ -617,8 +615,6 @@ github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4=
617615
github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A=
618616
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
619617
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
620-
github.com/pkg/diff v0.0.0-20200914180035-5b29258ca4f7 h1:+/+DxvQaYifJ+grD4klzrS5y+KJXldn/2YTl5JG+vZ8=
621-
github.com/pkg/diff v0.0.0-20200914180035-5b29258ca4f7/go.mod h1:zO8QMzTeZd5cpnIkz/Gn6iK0jDfGicM1nynOkkPIl28=
622618
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
623619
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
624620
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -662,7 +658,6 @@ github.com/sendgrid/rest v2.6.9+incompatible h1:1EyIcsNdn9KIisLW50MKwmSRSK+ekuei
662658
github.com/sendgrid/rest v2.6.9+incompatible/go.mod h1:kXX7q3jZtJXK5c5qK83bSGMdV6tsOE70KbHoqJls4lE=
663659
github.com/sendgrid/sendgrid-go v3.16.1+incompatible h1:zWhTmB0Y8XCDzeWIm2/BIt1GjJohAA0p6hVEaDtHWWs=
664660
github.com/sendgrid/sendgrid-go v3.16.1+incompatible/go.mod h1:QRQt+LX/NmgVEvmdRw0VT/QgUn499+iza2FnDca9fg8=
665-
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
666661
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
667662
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
668663
github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4=
@@ -708,8 +703,6 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
708703
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
709704
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
710705
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
711-
github.com/tailscale/depaware v0.0.0-20250112153213-b748de04d81b h1:ewWb4cA+YO9/3X+v5UhdV+eKFsNBOPcGRh39Glshx/4=
712-
github.com/tailscale/depaware v0.0.0-20250112153213-b748de04d81b/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8=
713706
github.com/testcontainers/testcontainers-go v0.34.0 h1:5fbgF0vIN5u+nD3IWabQwRybuB4GY8G2HHgCkbMzMHo=
714707
github.com/testcontainers/testcontainers-go v0.34.0/go.mod h1:6P/kMkQe8yqPHfPWNulFGdFHTD8HB2vLq/231xY2iPQ=
715708
github.com/testcontainers/testcontainers-go/modules/elasticsearch v0.34.0 h1:BBwJUs9xBpt1uOfO+yAr2pYW75MsyzuO/o70HTPnhe4=
@@ -864,7 +857,6 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
864857
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
865858
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
866859
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
867-
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
868860
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
869861
golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
870862
golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
@@ -997,12 +989,9 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK
997989
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
998990
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
999991
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
1000-
golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
1001992
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
1002993
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
1003994
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
1004-
golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0=
1005-
golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
1006995
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1007996
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1008997
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ func run(state overseer.State) {
469469
feature.UseSimplifiedGitlabEnumeration.Store(true)
470470
feature.GitlabProjectsPerPage.Store(100)
471471

472+
// OSS Default using github graphql api for issues, pr's and comments
473+
feature.UseGithubGraphQLAPI.Store(false)
474+
472475
conf := &config.Config{}
473476
if *configFilename != "" {
474477
var err error

pkg/common/depaware.go

Lines changed: 0 additions & 5 deletions
This file was deleted.

pkg/detectors/browserstack/browserstack.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
regexp "github.com/wasilibs/go-re2"
1212
"golang.org/x/net/publicsuffix"
1313

14+
"github.com/trufflesecurity/trufflehog/v3/pkg/common"
1415
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
1516
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb"
1617
)
@@ -93,6 +94,8 @@ func verifyBrowserStackCredentials(ctx context.Context, client *http.Client, use
9394
return false, err
9495
}
9596
req.Header.Add("Content-Type", "application/json")
97+
req.Header.Add("User-Agent", common.UserAgent())
98+
9699
req.SetBasicAuth(username, accessKey)
97100

98101
res, err := client.Do(req)

pkg/feature/feature.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var (
1111
UseSimplifiedGitlabEnumeration atomic.Bool
1212
UseGitMirror atomic.Bool
1313
GitlabProjectsPerPage atomic.Int64
14+
UseGithubGraphQLAPI atomic.Bool // use github graphql api to fetch issues, pr's and comments
1415
)
1516

1617
type AtomicString struct {

0 commit comments

Comments
 (0)