Skip to content
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0aed877
Fix mixed indentation in alchemy test
bradlarsen Sep 2, 2025
93507a0
Use `strings.ReplaceAll(...)` instead of `strings.Replace(..., -1)`
bradlarsen Sep 2, 2025
06c54aa
Use integer range loop instead of explicit counting loop
bradlarsen Sep 2, 2025
eba7d3d
Revise and expand detectors.go comments
bradlarsen Sep 4, 2025
080d11f
Draft a generic JWT detector
bradlarsen Sep 4, 2025
ed7881e
Add comments; simplify JWKS-fetching code
bradlarsen Sep 11, 2025
9fad52c
Fix bugs; refine regex and keywords; refine comments and error messages
bradlarsen Sep 16, 2025
1d464ad
Use github.com/lestrrat-go/jwx to parse JWK sets
bradlarsen Sep 17, 2025
9dc2a6d
Relax JWT regex to allow for spec-disallowed but sometimes present ba…
bradlarsen Sep 17, 2025
433518a
Refine error messages; check JWT issuer for localhost and exclude ver…
bradlarsen Sep 22, 2025
ea955c4
Update README to note JWT support
bradlarsen Sep 25, 2025
7ebc7b5
exclude private hosts from JWKS retrieval
bradlarsen Sep 25, 2025
345b3e8
Allow EdDSA JWTs
bradlarsen Sep 25, 2025
93e6fa8
Cleanup
bradlarsen Sep 25, 2025
6051904
Support unknown verification of HMAC JWTs; include some claims in Ext…
bradlarsen Sep 25, 2025
853346e
cleanup; expand unit tests
bradlarsen Sep 26, 2025
6e8bba3
Merge branch 'main' into jwt
kashifkhan0771 Sep 30, 2025
671316c
Use more efficient set representation
bradlarsen Sep 30, 2025
947a1da
Do not give HMAC JWTs an `unknown` status
bradlarsen Oct 1, 2025
b681c55
Include `alg` in extra data
bradlarsen Oct 1, 2025
8899a54
Be more explicit about JWT verification error propagation
bradlarsen Oct 3, 2025
13a5e05
Merge branch 'main' into jwt
bradlarsen Oct 3, 2025
8e3057a
Merge branch 'main' into jwt
bradlarsen Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ To learn more about TruffleHog and its features and capabilities, visit our [pro

# :globe_with_meridians: TruffleHog Enterprise

Are you interested in continuously monitoring **Git, Jira, Slack, Confluence, Microsoft Teams, Sharepoint, and more..** for credentials? We have an enterprise product that can help! Learn more at <https://trufflesecurity.com/trufflehog-enterprise>.
Are you interested in continuously monitoring **Git, Jira, Slack, Confluence, Microsoft Teams, Sharepoint (and more)** for credentials? We have an enterprise product that can help! Learn more at <https://trufflesecurity.com/trufflehog-enterprise>.

We take the revenue from the enterprise product to fund more awesome open source projects that the whole community can benefit from.

</div>

# What is TruffleHog 🐽

TruffleHog is the most powerful secrets **Discovery, Classification, Validation,** and **Analysis** tool. In this context, secret refers to a credential a machine uses to authenticate itself to another machine. This includes API keys, database passwords, private encryption keys, and more...
TruffleHog is the most powerful secrets **Discovery, Classification, Validation,** and **Analysis** tool. In this context, secret refers to a credential a machine uses to authenticate itself to another machine. This includes API keys, database passwords, private encryption keys, and more.

## Discovery 🔍

TruffleHog can look for secrets in many places including Git, chats, wikis, logs, API testing platforms, object stores, filesystems and more
TruffleHog can look for secrets in many places including Git, chats, wikis, logs, API testing platforms, object stores, filesystems and more.

## Classification 📁

Expand Down Expand Up @@ -667,7 +667,7 @@ TruffleHog can be used in a pre-commit hook to prevent credentials from leaking

See the [pre-commit hook documentation](PreCommit.md) for more information.

## Regex Detector (alpha)
## Custom Regex Detector (alpha)

TruffleHog supports detection and verification of custom regular expressions.
For detection, at least one **regular expression** and **keyword** is required.
Expand All @@ -688,6 +688,10 @@ your custom detector has multiple `regex` set (in this example `hogID`, and `hog
### Regex Detector Example
[Here](/pkg/custom_detectors/CUSTOM_DETECTORS.md) is how to setup a custom regex detector with verification server.

## Generic JWT Detection

TruffleHog supports detection and verification of a subset of generic JWTs it finds.
Specifically, if a JWT uses public-key cryptography rather than HMAC and the public key can be obtained, TruffleHog can determine whether the JWT is live or not.

## :mag: Analyze

Expand Down
29 changes: 18 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/trufflesecurity/trufflehog/v3

go 1.24
go 1.24.4

toolchain go1.24.5

Expand Down Expand Up @@ -70,6 +70,7 @@ require (
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213
github.com/klauspost/pgzip v1.2.6
github.com/kylelemons/godebug v1.1.0
github.com/lestrrat-go/jwx/v3 v3.0.11
github.com/lib/pq v1.10.9
github.com/lrstanley/bubblezone v0.0.0-20250404061050-e13639e27357
github.com/marusama/semaphore/v2 v2.5.0
Expand All @@ -90,7 +91,7 @@ require (
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
github.com/shuheiktgw/go-travis v0.3.1
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7
github.com/stretchr/testify v1.10.0
github.com/stretchr/testify v1.11.1
github.com/tailscale/depaware v0.0.0-20250112153213-b748de04d81b
github.com/testcontainers/testcontainers-go v0.34.0
github.com/testcontainers/testcontainers-go/modules/elasticsearch v0.34.0
Expand All @@ -106,11 +107,11 @@ require (
go.uber.org/automaxprocs v1.6.0
go.uber.org/mock v0.5.2
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.41.0
golang.org/x/crypto v0.42.0
golang.org/x/net v0.43.0
golang.org/x/oauth2 v0.30.0
golang.org/x/sync v0.16.0
golang.org/x/text v0.28.0
golang.org/x/sync v0.17.0
golang.org/x/text v0.29.0
golang.org/x/time v0.12.0
google.golang.org/api v0.247.0
google.golang.org/protobuf v1.36.9
Expand Down Expand Up @@ -185,6 +186,7 @@ require (
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/docker/cli v28.2.2+incompatible // indirect
Expand All @@ -205,14 +207,14 @@ require (
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v1.0.0 // indirect
github.com/google/go-github/v69 v69.0.0 // indirect
github.com/google/go-github/v72 v72.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 // indirect
Expand All @@ -231,6 +233,11 @@ require (
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/lestrrat-go/blackmagic v1.0.4 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc/v3 v3.0.1 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/lestrrat-go/option/v2 v2.0.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand All @@ -254,7 +261,6 @@ require (
github.com/muesli/termenv v0.16.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nwaples/rardecode/v2 v2.0.0-beta.4.0.20241112120701-034e449c6e78 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
Expand All @@ -269,6 +275,7 @@ require (
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sendgrid/rest v2.6.9+incompatible // indirect
github.com/shirou/gopsutil/v3 v3.23.12 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
Expand Down Expand Up @@ -311,10 +318,10 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
golang.org/x/mod v0.26.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/term v0.34.0 // indirect
golang.org/x/tools v0.35.0 // indirect
golang.org/x/mod v0.27.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/term v0.35.0 // indirect
golang.org/x/tools v0.36.0 // indirect
google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect
Expand Down
Loading