Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Import 27 new detectors (#737)
Dustin Decker2452e93a80d3
diff --git a/pkg/detectors/courier/courier.go b/pkg/detectors/courier/courier.goindex 6941fc7f0..c50ea49a2 100644--- a/pkg/detectors/courier/courier.go+++ b/pkg/detectors/courier/courier.go@@ -56,7 +56,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Accept", "application/json")req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)- fmt.Println(res)if err == nil {defer res.Body.Close()if res.StatusCode >= 200 && res.StatusCode < 300 {diff --git a/pkg/detectors/docparser/docparser.go b/pkg/detectors/docparser/docparser.goindex 76a58e6c8..595dff59a 100644--- a/pkg/detectors/docparser/docparser.go+++ b/pkg/detectors/docparser/docparser.go@@ -49,8 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif verify {url := fmt.Sprintf("https://api.docparser.com/v1/parsers?api_key=%s", resMatch)- fmt.Println(url)- req, err := http.NewRequestWithContext(ctx, "GET",url, nil)+ req, err := http.NewRequestWithContext(ctx, "GET", url, nil)if err != nil {continue}diff --git a/pkg/detectors/honeycomb/honeycomb.go b/pkg/detectors/honeycomb/honeycomb.goindex 2064c8db6..543b29aa7 100644--- a/pkg/detectors/honeycomb/honeycomb.go+++ b/pkg/detectors/honeycomb/honeycomb.go@@ -20,7 +20,7 @@ var (client = common.SaneHttpClient()// Make sure that your group is surrounded in boundary characters such as below to reduce false positives.- keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"Honeycomb"}) + `\b([0-9Aa-z-A-Z]{22})\b`)+ keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"Honeycomb"}) + `\b([0-9a-zA-Z]{22})\b`))// Keywords are used for efficiently pre-filtering chunks.diff --git a/pkg/detectors/kanbantool/kanbantool.go b/pkg/detectors/kanbantool/kanbantool.goindex 819d9a5be..0f6e8bb6a 100644--- a/pkg/detectors/kanbantool/kanbantool.go+++ b/pkg/detectors/kanbantool/kanbantool.go@@ -21,9 +21,8 @@ var (client = common.SaneHttpClient()//Make sure that your group is surrounded in boundry characters such as below to reduce false positives- keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"kanbantool"}) + `\b([0-9A-Z]{12})\b`)+ keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"kanbantool"}) + `\b([0-9A-Z]{12})\b`)domainPat = regexp.MustCompile(detectors.PrefixRegex([]string{"kanbantool"}) + `\b([a-z0-9A-Z]{2,22})\b`)-)// Keywords are used for efficiently pre-filtering chunks.@@ -38,47 +37,46 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultmatches := keyPat.FindAllStringSubmatch(dataStr, -1)idMatches := domainPat.FindAllStringSubmatch(dataStr, -1)- fmt.Println(idMatches)for _, match := range matches {if len(match) != 2 {continue}resMatch := strings.TrimSpace(match[1])- for _, idMatch := range idMatches {- if len(idMatch) != 2 {- continue- }- resIdMatch := strings.TrimSpace(idMatch[1])+ for _, idMatch := range idMatches {+ if len(idMatch) != 2 {+ continue+ }+ resIdMatch := strings.TrimSpace(idMatch[1])- s1 := detectors.Result{- DetectorType: detectorspb.DetectorType_Kanbantool,- Raw: []byte(resMatch),+ s1 := detectors.Result{+ DetectorType: detectorspb.DetectorType_Kanbantool,+ Raw: []byte(resMatch),+ }+ if verify {+ url := fmt.Sprintf("https://%s.kanbantool.com/api/v3/users/current.json", resIdMatch)+ req, err := http.NewRequestWithContext(ctx, "GET", url, nil)+ if err != nil {+ continue}- if verify {- url := fmt.Sprintf("https://%s.kanbantool.com/api/v3/users/current.json",resIdMatch)- req, err := http.NewRequestWithContext(ctx, "GET", url, nil)- if err != nil {- continue- }- req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))- res, err := client.Do(req)- if err == nil {- defer res.Body.Close()- if res.StatusCode >= 200 && res.StatusCode < 300 {- s1.Verified = true- } else {- //This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key- if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {- continue- }+ req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))+ res, err := client.Do(req)+ if err == nil {+ defer res.Body.Close()+ if res.StatusCode >= 200 && res.StatusCode < 300 {+ s1.Verified = true+ } else {+ //This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key+ if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {+ continue}}}-- results = append(results, s1)}-++ results = append(results, s1)+ }+}return detectors.CleanResults(results), nildiff --git a/pkg/detectors/razorpay/razorpay.go b/pkg/detectors/razorpay/razorpay.goindex 5a4f22354..c5eb5ac28 100644--- a/pkg/detectors/razorpay/razorpay.go+++ b/pkg/detectors/razorpay/razorpay.go@@ -16,7 +16,7 @@ type Scanner struct{}// Ensure the Scanner satisfies the interface at compile time.var _ detectors.Detector = (*Scanner)(nil)-//The (`) character adds secondary encoding to parsed strings by Golang which also allows for escape sequences+// The (`) character adds secondary encoding to parsed strings by Golang which also allows for escape sequencesvar (keyPat = regexp.MustCompile(`(?i)\brzp_\w{2,6}_\w{10,20}\b`)secretPat = regexp.MustCompile(`(?:razor|secret|rzp|key)[-\w]*[\" :=']*([A-Za-z0-9]{20,50})`)@@ -69,7 +69,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result//TODO debug with responses. could still be invalid at this stages.Verified = true- // fmt.Println(resp)}}diff --git a/pkg/detectors/stytch/stytch.go b/pkg/detectors/stytch/stytch.goindex 86ff88d5e..f5b5a09e6 100644--- a/pkg/detectors/stytch/stytch.go+++ b/pkg/detectors/stytch/stytch.go@@ -2,7 +2,6 @@ package stytchimport ("context"- "fmt""net/http""regexp""strings"@@ -55,8 +54,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}if verify {- fmt.Println(userPatMatch)- fmt.Println(tokenPatMatch)req, err := http.NewRequestWithContext(ctx, "GET", "https://api.stytch.com/v1/users/pending", nil)if err != nil {continuediff --git a/pkg/engine/defaults.go b/pkg/engine/defaults.goindex c763c3185..e67bc944d 100644--- a/pkg/engine/defaults.go+++ b/pkg/engine/defaults.go@@ -32,11 +32,13 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/apiflash""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/apifonica""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/apify"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/apilayer""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/apimatic""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/apiscience""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/apitemplate""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/appcues""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/appfollow"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/appointedd""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/appsynergy""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/apptivo""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/artsy"@@ -76,6 +78,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/bombbomb""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/boostnote""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/borgbase"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/braintreepayments""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/brandfetch""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/browserstack""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/browshot"@@ -131,6 +134,8 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/cloze""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/clustdoc""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/codacy"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/codeclimate"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/codemagic""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/codequiry""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/coinapi""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/coinbase"@@ -172,6 +177,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/deepai""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/deepgram""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/delighted"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/demio""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/deputy""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/detectify""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/detectlanguage"@@ -184,6 +190,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/disqus""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ditto""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dnscheck"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/docparser""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/documo""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/doppler""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dotmailer"@@ -191,11 +198,13 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dronahq""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/droneci""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dropbox"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/duply""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dwolla""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dynalist""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dyspatch""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/eagleeyenetworks""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/easyinsight"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/ecostruxureit""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/edamam""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/edenai""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/eightxeight"@@ -228,6 +237,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/fleetbase""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/flickr""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/flightapi"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/flightlabs""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/flightstats""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/float""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/flowdash"@@ -238,6 +248,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/formbucket""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/formcraft""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/formio"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/formsite""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/foursquare""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/frameio""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/freshbooks"@@ -257,6 +268,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/geoipifi""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/getgeoapi""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/getgist"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/getresponse""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/getsandbox""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/github""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/github_old"@@ -272,12 +284,14 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/graphcms""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/graphhopper""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/groovehq"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/gtmetrix""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/guardianapi""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/gumroad""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/gyazo""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/happi""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/happyscribe""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/harvest"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/heatmapapi""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/hellosign""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/helpcrunch""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/helpscout"@@ -285,6 +299,8 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/heroku""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/hiveage""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/holidayapi"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/holistic"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/honeycomb""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/host""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/html2pdf""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/hubspotapikey"@@ -318,6 +334,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/jumpcloud""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/juro""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/kanban"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/kanbantool""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/karmacrm""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/keenio""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/kickbox"@@ -331,6 +348,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/lastfm""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/launchdarkly""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/leadfeeder"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/lemlist""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/lendflow""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/lessannoyingcrm""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/lexigram"@@ -381,6 +399,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/mockaroo""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/moderation""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/monday"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/monkeylearn""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/moonclerck""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/moonclerk""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/moosend"@@ -431,6 +450,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/paralleldots""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/parsehub""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/parsers"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/parseur""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/partnerstack""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/passbase""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/pastebin"@@ -463,6 +483,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/postmark""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/powrbot""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/privatekey"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/prodpad""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/prospectcrm""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/prospectio""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/protocolsio"@@ -504,10 +525,12 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/salesblink""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/salescookie""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/salesflare"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/salesmate""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/satismeterprojectkey""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/satismeterwritekey""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/saucelabs""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/scalewaykey"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/scalr""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/scrapeowl""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/scraperapi""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/scraperbox"@@ -619,14 +642,17 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/timezoneapi""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/tmetric""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/todoist"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/tokeet""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/tomorrowio""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/tomtom""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/tradier"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/transferwise""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/travelpayouts""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/travisci""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/trelloapikey""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/twelvedata""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/twilio"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/twist""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/twitch""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/twitter""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/tyntec"@@ -669,6 +695,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/webflow""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/webscraper""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/webscraping"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/websitepulse""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/whoxy""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/wistia""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/worksnaps"@@ -1417,5 +1444,32 @@ func DefaultDetectors() []detectors.Detector {postbacks.Scanner{},collect2.Scanner{},uclassify.Scanner{},+ holistic.Scanner{},+ tokeet.Scanner{},+ duply.Scanner{},+ gtmetrix.Scanner{},+ braintreepayments.Scanner{},+ docparser.Scanner{},+ formsite.Scanner{},+ flightlabs.Scanner{},+ getresponse.Scanner{},+ codeclimate.Scanner{},+ apilayer.Scanner{},+ monkeylearn.Scanner{},+ parseur.Scanner{},+ honeycomb.Scanner{},+ demio.Scanner{},+ kanbantool.Scanner{},+ salesmate.Scanner{},+ lemlist.Scanner{},+ websitepulse.Scanner{},+ scalr.Scanner{},+ ecostruxureit.Scanner{},+ heatmapapi.Scanner{},+ appointedd.Scanner{},+ twist.Scanner{},+ prodpad.Scanner{},+ transferwise.Scanner{},+ codemagic.Scanner{},}}