diff --git a/pkg/detectors/abbysale/abbysale.go b/pkg/detectors/abbysale/abbysale.go index 047c89d0822f..e2927992ba42 100644 --- a/pkg/detectors/abbysale/abbysale.go +++ b/pkg/detectors/abbysale/abbysale.go @@ -49,9 +49,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/abstract/abstract.go b/pkg/detectors/abstract/abstract.go index d6db71a9fa49..431a828cdb81 100644 --- a/pkg/detectors/abstract/abstract.go +++ b/pkg/detectors/abstract/abstract.go @@ -48,9 +48,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/abuseipdb/abuseipdb.go b/pkg/detectors/abuseipdb/abuseipdb.go index 238f59530218..15b4c5b426ab 100644 --- a/pkg/detectors/abuseipdb/abuseipdb.go +++ b/pkg/detectors/abuseipdb/abuseipdb.go @@ -51,9 +51,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/accuweather/accuweather.go b/pkg/detectors/accuweather/accuweather.go index 7fdac2635b58..1938af6be7cc 100644 --- a/pkg/detectors/accuweather/accuweather.go +++ b/pkg/detectors/accuweather/accuweather.go @@ -49,9 +49,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/adafruitio/adafruitio.go b/pkg/detectors/adafruitio/adafruitio.go index 612879b24122..8db10d14be5a 100644 --- a/pkg/detectors/adafruitio/adafruitio.go +++ b/pkg/detectors/adafruitio/adafruitio.go @@ -49,9 +49,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/adobeio/adobeio.go b/pkg/detectors/adobeio/adobeio.go index 1efe07cbbd74..d2f8d9563511 100644 --- a/pkg/detectors/adobeio/adobeio.go +++ b/pkg/detectors/adobeio/adobeio.go @@ -2,10 +2,11 @@ package adobeio import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/adzuna/adzuna.go b/pkg/detectors/adzuna/adzuna.go index 5fb06ba2dc1b..cbea3f0c3653 100644 --- a/pkg/detectors/adzuna/adzuna.go +++ b/pkg/detectors/adzuna/adzuna.go @@ -3,10 +3,11 @@ package adzuna import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -49,15 +50,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/aeroworkflow/aeroworkflow.go b/pkg/detectors/aeroworkflow/aeroworkflow.go index 1bbff9e03c4b..768d9d5d24aa 100644 --- a/pkg/detectors/aeroworkflow/aeroworkflow.go +++ b/pkg/detectors/aeroworkflow/aeroworkflow.go @@ -51,15 +51,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/agora/agora.go b/pkg/detectors/agora/agora.go index fe7fb55c6c49..695c17abead6 100644 --- a/pkg/detectors/agora/agora.go +++ b/pkg/detectors/agora/agora.go @@ -51,16 +51,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secret := range secretMatches { - if len(secret) != 2 { - continue - } resSecret := strings.TrimSpace(secret[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aha/aha.go b/pkg/detectors/aha/aha.go index 9126386c9cba..436eae520ebb 100644 --- a/pkg/detectors/aha/aha.go +++ b/pkg/detectors/aha/aha.go @@ -49,16 +49,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resURLMatch := "aha.io" for _, URLmatch := range URLmatches { - if len(URLmatch) != 2 { - continue - } resURLMatch = strings.TrimSpace(URLmatch[1]) } for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go b/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go index 1c98fd610090..79ee916646c1 100644 --- a/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go +++ b/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) diff --git a/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go b/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go index 5f1a916d1e1c..443bd2a95692 100644 --- a/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go +++ b/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/airship/airship.go b/pkg/detectors/airship/airship.go index 8479fe75cefd..5780f564cced 100644 --- a/pkg/detectors/airship/airship.go +++ b/pkg/detectors/airship/airship.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/airtableapikey/airtableapikey.go b/pkg/detectors/airtableapikey/airtableapikey.go index 01ca34972081..734ebdd89040 100644 --- a/pkg/detectors/airtableapikey/airtableapikey.go +++ b/pkg/detectors/airtableapikey/airtableapikey.go @@ -53,16 +53,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } keyRes := strings.TrimSpace(keyMatch[1]) for _, appMatch := range appMatches { - if len(appMatch) != 2 { - continue - } appRes := strings.TrimSpace(appMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/airvisual/airvisual.go b/pkg/detectors/airvisual/airvisual.go index ee2ac2978187..241d9b35df2d 100644 --- a/pkg/detectors/airvisual/airvisual.go +++ b/pkg/detectors/airvisual/airvisual.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aiven/aiven.go b/pkg/detectors/aiven/aiven.go index 9f514c73bda6..1499d3b17d96 100644 --- a/pkg/detectors/aiven/aiven.go +++ b/pkg/detectors/aiven/aiven.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/alconost/alconost.go b/pkg/detectors/alconost/alconost.go index 1a7faf98db97..26346db89f43 100644 --- a/pkg/detectors/alconost/alconost.go +++ b/pkg/detectors/alconost/alconost.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/alegra/alegra.go b/pkg/detectors/alegra/alegra.go index c23b5cb12b2e..09e30fe5b881 100644 --- a/pkg/detectors/alegra/alegra.go +++ b/pkg/detectors/alegra/alegra.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/aletheiaapi/aletheiaapi.go b/pkg/detectors/aletheiaapi/aletheiaapi.go index 1c83a01f6b37..356634c18653 100644 --- a/pkg/detectors/aletheiaapi/aletheiaapi.go +++ b/pkg/detectors/aletheiaapi/aletheiaapi.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/algoliaadminkey/algoliaadminkey.go b/pkg/detectors/algoliaadminkey/algoliaadminkey.go index ee0739ac9b40..9fa302c32c04 100644 --- a/pkg/detectors/algoliaadminkey/algoliaadminkey.go +++ b/pkg/detectors/algoliaadminkey/algoliaadminkey.go @@ -38,14 +38,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/alibaba/alibaba.go b/pkg/detectors/alibaba/alibaba.go index 0a5f5a035114..4c0bd1f1fb78 100644 --- a/pkg/detectors/alibaba/alibaba.go +++ b/pkg/detectors/alibaba/alibaba.go @@ -91,15 +91,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) diff --git a/pkg/detectors/alienvault/alienvault.go b/pkg/detectors/alienvault/alienvault.go index 15e281c074f2..3c4ca8de0e44 100644 --- a/pkg/detectors/alienvault/alienvault.go +++ b/pkg/detectors/alienvault/alienvault.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/allsports/allsports.go b/pkg/detectors/allsports/allsports.go index e71ebdeafaeb..012d4d9e6d48 100644 --- a/pkg/detectors/allsports/allsports.go +++ b/pkg/detectors/allsports/allsports.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/amadeus/amadeus.go b/pkg/detectors/amadeus/amadeus.go index 37893d126c7e..27f35a47a966 100644 --- a/pkg/detectors/amadeus/amadeus.go +++ b/pkg/detectors/amadeus/amadeus.go @@ -2,11 +2,12 @@ package amadeus import ( "context" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ambee/ambee.go b/pkg/detectors/ambee/ambee.go index 3f2d498dfb8d..3c72a75d9d22 100644 --- a/pkg/detectors/ambee/ambee.go +++ b/pkg/detectors/ambee/ambee.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/amplitudeapikey/amplitudeapikey.go b/pkg/detectors/amplitudeapikey/amplitudeapikey.go index c48cbc1073d5..87c1a9684911 100644 --- a/pkg/detectors/amplitudeapikey/amplitudeapikey.go +++ b/pkg/detectors/amplitudeapikey/amplitudeapikey.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/anthropic/anthropic.go b/pkg/detectors/anthropic/anthropic.go index a68cd90be103..643afa2efe79 100644 --- a/pkg/detectors/anthropic/anthropic.go +++ b/pkg/detectors/anthropic/anthropic.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/anypoint/anypoint.go b/pkg/detectors/anypoint/anypoint.go index f001a7bfe6c8..316dd3fb70ff 100644 --- a/pkg/detectors/anypoint/anypoint.go +++ b/pkg/detectors/anypoint/anypoint.go @@ -3,10 +3,11 @@ package anypoint import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result orgMatches := orgPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, orgMatch := range orgMatches { - if len(orgMatch) != 2 { - continue - } orgRes := strings.TrimSpace(orgMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apacta/apacta.go b/pkg/detectors/apacta/apacta.go index 9b43384f68fb..e8c2cefad7bb 100644 --- a/pkg/detectors/apacta/apacta.go +++ b/pkg/detectors/apacta/apacta.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/api2cart/api2cart.go b/pkg/detectors/api2cart/api2cart.go index 050614e03e8a..17c49f3851b7 100644 --- a/pkg/detectors/api2cart/api2cart.go +++ b/pkg/detectors/api2cart/api2cart.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apideck/apideck.go b/pkg/detectors/apideck/apideck.go index 68f037e3d383..6b3dbe976b9d 100644 --- a/pkg/detectors/apideck/apideck.go +++ b/pkg/detectors/apideck/apideck.go @@ -3,10 +3,11 @@ package apideck import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/apiflash/apiflash.go b/pkg/detectors/apiflash/apiflash.go index 9a6e1aee84cd..fa4f7257a324 100644 --- a/pkg/detectors/apiflash/apiflash.go +++ b/pkg/detectors/apiflash/apiflash.go @@ -3,10 +3,11 @@ package apiflash import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resUrlMatch := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apifonica/apifonica.go b/pkg/detectors/apifonica/apifonica.go index bf770b3e3354..b6bf98eb56c9 100644 --- a/pkg/detectors/apifonica/apifonica.go +++ b/pkg/detectors/apifonica/apifonica.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result tokenMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, tokenMatch := range tokenMatches { - if len(tokenMatch) != 2 { - continue - } resToken := strings.TrimSpace(tokenMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apify/apify.go b/pkg/detectors/apify/apify.go index f612c217bad5..680afc7e2c9f 100644 --- a/pkg/detectors/apify/apify.go +++ b/pkg/detectors/apify/apify.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apilayer/apilayer.go b/pkg/detectors/apilayer/apilayer.go index 07d673db325e..6b6093699bf9 100644 --- a/pkg/detectors/apilayer/apilayer.go +++ b/pkg/detectors/apilayer/apilayer.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apimatic/apimatic.go b/pkg/detectors/apimatic/apimatic.go index 0e843c80ff72..17f325b16176 100644 --- a/pkg/detectors/apimatic/apimatic.go +++ b/pkg/detectors/apimatic/apimatic.go @@ -2,11 +2,12 @@ package apimatic import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" "time" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passMatches := passPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } userPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range passMatches { - if len(idMatch) != 2 { - continue - } passPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/apiscience/apiscience.go b/pkg/detectors/apiscience/apiscience.go index a813b36c72a1..0f744f2f0768 100644 --- a/pkg/detectors/apiscience/apiscience.go +++ b/pkg/detectors/apiscience/apiscience.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apitemplate/apitemplate.go b/pkg/detectors/apitemplate/apitemplate.go index 8cc24b064a4a..57f56a37bb49 100644 --- a/pkg/detectors/apitemplate/apitemplate.go +++ b/pkg/detectors/apitemplate/apitemplate.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apollo/apollo.go b/pkg/detectors/apollo/apollo.go index 6e8dedcc3da1..d52590e681a3 100644 --- a/pkg/detectors/apollo/apollo.go +++ b/pkg/detectors/apollo/apollo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/appcues/appcues.go b/pkg/detectors/appcues/appcues.go index 7e66993f88d7..475bd62ba5c0 100644 --- a/pkg/detectors/appcues/appcues.go +++ b/pkg/detectors/appcues/appcues.go @@ -3,10 +3,11 @@ package appcues import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,22 +42,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUserMatch := strings.TrimSpace(userMatch[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/appfollow/appfollow.go b/pkg/detectors/appfollow/appfollow.go index 37fc5a9ad884..5f16b1658421 100644 --- a/pkg/detectors/appfollow/appfollow.go +++ b/pkg/detectors/appfollow/appfollow.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/appointedd/appointedd.go b/pkg/detectors/appointedd/appointedd.go index dedc59c93f87..d250f7780b3d 100644 --- a/pkg/detectors/appointedd/appointedd.go +++ b/pkg/detectors/appointedd/appointedd.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/appoptics/appoptics.go b/pkg/detectors/appoptics/appoptics.go index aed6875e0150..bf0034ef71e6 100644 --- a/pkg/detectors/appoptics/appoptics.go +++ b/pkg/detectors/appoptics/appoptics.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/appsynergy/appsynergy.go b/pkg/detectors/appsynergy/appsynergy.go index 4aaf50269120..6d5cb2057294 100644 --- a/pkg/detectors/appsynergy/appsynergy.go +++ b/pkg/detectors/appsynergy/appsynergy.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/apptivo/apptivo.go b/pkg/detectors/apptivo/apptivo.go index 2be5fe94d8b4..8da040d1a701 100644 --- a/pkg/detectors/apptivo/apptivo.go +++ b/pkg/detectors/apptivo/apptivo.go @@ -3,11 +3,12 @@ package apptivo import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -40,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/artifactory/artifactory.go b/pkg/detectors/artifactory/artifactory.go index 8b5236446a6e..dc75d5f96220 100644 --- a/pkg/detectors/artifactory/artifactory.go +++ b/pkg/detectors/artifactory/artifactory.go @@ -49,16 +49,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resURLMatch := "" for _, URLmatch := range URLmatches { - if len(URLmatch) != 2 { - continue - } resURLMatch = strings.TrimSpace(URLmatch[1]) } for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/artsy/artsy.go b/pkg/detectors/artsy/artsy.go index 77ab08fa2082..6b2a94fe158b 100644 --- a/pkg/detectors/artsy/artsy.go +++ b/pkg/detectors/artsy/artsy.go @@ -2,10 +2,11 @@ package artsy import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,16 +39,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/asanaoauth/asanaoauth.go b/pkg/detectors/asanaoauth/asanaoauth.go index ee7df3d2d714..6ee968fc90a4 100644 --- a/pkg/detectors/asanaoauth/asanaoauth.go +++ b/pkg/detectors/asanaoauth/asanaoauth.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go b/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go index 3e7342d474b6..1018fe32de48 100644 --- a/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go +++ b/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/assemblyai/assemblyai.go b/pkg/detectors/assemblyai/assemblyai.go index 4788823e5bdd..78973115d31f 100644 --- a/pkg/detectors/assemblyai/assemblyai.go +++ b/pkg/detectors/assemblyai/assemblyai.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/atera/atera.go b/pkg/detectors/atera/atera.go index d7f8d6257cf7..1aafdacef4fa 100644 --- a/pkg/detectors/atera/atera.go +++ b/pkg/detectors/atera/atera.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/audd/audd.go b/pkg/detectors/audd/audd.go index 58ecc17a8598..ae03b425a823 100644 --- a/pkg/detectors/audd/audd.go +++ b/pkg/detectors/audd/audd.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go b/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go index e4081d292153..3462682243a2 100644 --- a/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go +++ b/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go @@ -40,18 +40,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, managementApiTokenMatch := range managementApiTokenMatches { - if len(managementApiTokenMatch) != 2 { - continue - } managementApiTokenRes := strings.TrimSpace(managementApiTokenMatch[1]) if len(managementApiTokenRes) < 2000 || len(managementApiTokenRes) > 5000 { continue } for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/auth0oauth/auth0oauth.go b/pkg/detectors/auth0oauth/auth0oauth.go index 25ce7d035666..8a56bed9f194 100644 --- a/pkg/detectors/auth0oauth/auth0oauth.go +++ b/pkg/detectors/auth0oauth/auth0oauth.go @@ -41,21 +41,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, clientIdMatch := range clientIdMatches { - if len(clientIdMatch) != 2 { - continue - } clientIdRes := strings.TrimSpace(clientIdMatch[1]) for _, clientSecretMatch := range clientSecretMatches { - if len(clientSecretMatch) != 2 { - continue - } clientSecretRes := strings.TrimSpace(clientSecretMatch[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/autodesk/autodesk.go b/pkg/detectors/autodesk/autodesk.go index 1c8dbffea587..5ff9af7c6dc9 100644 --- a/pkg/detectors/autodesk/autodesk.go +++ b/pkg/detectors/autodesk/autodesk.go @@ -3,10 +3,11 @@ package autodesk import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/autoklose/autoklose.go b/pkg/detectors/autoklose/autoklose.go index b538b7948630..bf661f5d416f 100644 --- a/pkg/detectors/autoklose/autoklose.go +++ b/pkg/detectors/autoklose/autoklose.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/autopilot/autopilot.go b/pkg/detectors/autopilot/autopilot.go index cc913278695d..532a61e87552 100644 --- a/pkg/detectors/autopilot/autopilot.go +++ b/pkg/detectors/autopilot/autopilot.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go b/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go index b0b7a806ba48..64f9454eb1fa 100644 --- a/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go +++ b/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aviationstack/aviationstack.go b/pkg/detectors/aviationstack/aviationstack.go index ddefb6b3ddef..f49913bf49f3 100644 --- a/pkg/detectors/aviationstack/aviationstack.go +++ b/pkg/detectors/aviationstack/aviationstack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aws/aws.go b/pkg/detectors/aws/aws.go index 110a06566905..906dd38953db 100644 --- a/pkg/detectors/aws/aws.go +++ b/pkg/detectors/aws/aws.go @@ -147,9 +147,6 @@ func (s scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 3 { - continue - } resIDMatch := strings.TrimSpace(idMatch[1]) if s.skipIDs != nil { @@ -159,9 +156,6 @@ func (s scanner) FromData(ctx context.Context, verify bool, data []byte) (result } for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/awssessionkeys/awssessionkey.go b/pkg/detectors/awssessionkeys/awssessionkey.go index 643626a25dc0..7cbe44f2de94 100644 --- a/pkg/detectors/awssessionkeys/awssessionkey.go +++ b/pkg/detectors/awssessionkeys/awssessionkey.go @@ -101,9 +101,6 @@ func (s scanner) FromData(ctx context.Context, verify bool, data []byte) (result sessionMatches := sessionPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIDMatch := strings.TrimSpace(idMatch[1]) if s.skipIDs != nil { @@ -113,15 +110,9 @@ func (s scanner) FromData(ctx context.Context, verify bool, data []byte) (result } for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) for _, sessionMatch := range sessionMatches { - if len(sessionMatch) != 2 { - continue - } resSessionMatch := strings.TrimSpace(sessionMatch[1]) if !checkSessionToken(resSessionMatch, resSecretMatch) { continue diff --git a/pkg/detectors/axonaut/axonaut.go b/pkg/detectors/axonaut/axonaut.go index 03e14683b395..a975e19957af 100644 --- a/pkg/detectors/axonaut/axonaut.go +++ b/pkg/detectors/axonaut/axonaut.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/aylien/aylien.go b/pkg/detectors/aylien/aylien.go index cfe20a0984d6..630bb8f9a356 100644 --- a/pkg/detectors/aylien/aylien.go +++ b/pkg/detectors/aylien/aylien.go @@ -2,10 +2,11 @@ package aylien import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) diff --git a/pkg/detectors/ayrshare/ayrshare.go b/pkg/detectors/ayrshare/ayrshare.go index ca3be88647fd..da8d801a387e 100644 --- a/pkg/detectors/ayrshare/ayrshare.go +++ b/pkg/detectors/ayrshare/ayrshare.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go b/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go index d1996bb2ef0f..54959badf003 100644 --- a/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go +++ b/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result orgMatches := orgPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, orgMatch := range orgMatches { - if len(orgMatch) != 2 { - continue - } resOrgMatch := strings.TrimSpace(orgMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go b/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go index 6dd0673be512..0f52441ea18c 100644 --- a/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go +++ b/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result serviceMatches := servicePat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, serviceMatch := range serviceMatches { - if len(serviceMatch) != 2 { - continue - } resServiceMatch := strings.TrimSpace(serviceMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go b/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go index e6781286cafc..e21b217ab0e8 100644 --- a/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go +++ b/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { diff --git a/pkg/detectors/azurestorage/azurestorage.go b/pkg/detectors/azurestorage/azurestorage.go index 6aa0791edf8f..3691897010ef 100644 --- a/pkg/detectors/azurestorage/azurestorage.go +++ b/pkg/detectors/azurestorage/azurestorage.go @@ -56,9 +56,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 3 { - continue - } accountName := strings.TrimSpace(match[1]) accountKey := strings.TrimSpace(match[2]) diff --git a/pkg/detectors/bannerbear/bannerbear.go b/pkg/detectors/bannerbear/bannerbear.go index ba6c9e1570ed..f8fae8c3674c 100644 --- a/pkg/detectors/bannerbear/bannerbear.go +++ b/pkg/detectors/bannerbear/bannerbear.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/baremetrics/baremetrics.go b/pkg/detectors/baremetrics/baremetrics.go index c1e942904497..6f4f5e8d810e 100644 --- a/pkg/detectors/baremetrics/baremetrics.go +++ b/pkg/detectors/baremetrics/baremetrics.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/beamer/beamer.go b/pkg/detectors/beamer/beamer.go index bad69b3f8a03..39d0db02c49f 100644 --- a/pkg/detectors/beamer/beamer.go +++ b/pkg/detectors/beamer/beamer.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/beebole/beebole.go b/pkg/detectors/beebole/beebole.go index 4d67e25bb1fe..84aefc91797f 100644 --- a/pkg/detectors/beebole/beebole.go +++ b/pkg/detectors/beebole/beebole.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/besnappy/besnappy.go b/pkg/detectors/besnappy/besnappy.go index 6ad3fd57f8d0..cc18201e70eb 100644 --- a/pkg/detectors/besnappy/besnappy.go +++ b/pkg/detectors/besnappy/besnappy.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/besttime/besttime.go b/pkg/detectors/besttime/besttime.go index a0b19118d436..570479bfd317 100644 --- a/pkg/detectors/besttime/besttime.go +++ b/pkg/detectors/besttime/besttime.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/betterstack/betterstack.go b/pkg/detectors/betterstack/betterstack.go index 3770dacd8f65..3d8391314759 100644 --- a/pkg/detectors/betterstack/betterstack.go +++ b/pkg/detectors/betterstack/betterstack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/billomat/billomat.go b/pkg/detectors/billomat/billomat.go index cf2eba3d3236..27e3ff0ce296 100644 --- a/pkg/detectors/billomat/billomat.go +++ b/pkg/detectors/billomat/billomat.go @@ -3,10 +3,11 @@ package billomat import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bitbar/bitbar.go b/pkg/detectors/bitbar/bitbar.go index 9eca133784d0..0efeb18b7cfe 100644 --- a/pkg/detectors/bitbar/bitbar.go +++ b/pkg/detectors/bitbar/bitbar.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bitcoinaverage/bitcoinaverage.go b/pkg/detectors/bitcoinaverage/bitcoinaverage.go index 3e05dddf0228..022169b3b795 100644 --- a/pkg/detectors/bitcoinaverage/bitcoinaverage.go +++ b/pkg/detectors/bitcoinaverage/bitcoinaverage.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bitfinex/bitfinex.go b/pkg/detectors/bitfinex/bitfinex.go index 11d33230efcd..a25b007f3823 100644 --- a/pkg/detectors/bitfinex/bitfinex.go +++ b/pkg/detectors/bitfinex/bitfinex.go @@ -3,11 +3,13 @@ package bitfinex import ( "context" "flag" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/bitfinexcom/bitfinex-api-go/v2/rest" + "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/common" @@ -45,9 +47,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result apiSecretMatches := apiSecretPat.FindAllStringSubmatch(dataStr, -1) for _, apiKeyMatch := range apiKeyMatches { - if len(apiKeyMatch) != 2 { - continue - } apiKeyRes := strings.TrimSpace(apiKeyMatch[1]) s1 := detectors.Result{ @@ -56,9 +55,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } for _, apiSecretMatch := range apiSecretMatches { - if len(apiSecretMatch) != 2 { - continue - } apiSecretRes := strings.TrimSpace(apiSecretMatch[1]) if apiKeyRes == apiSecretRes { diff --git a/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go b/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go index 7b72d899e69e..e8dd069fba21 100644 --- a/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go +++ b/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bitmex/bitmex.go b/pkg/detectors/bitmex/bitmex.go index 01adc8d33fae..c73065729ca1 100644 --- a/pkg/detectors/bitmex/bitmex.go +++ b/pkg/detectors/bitmex/bitmex.go @@ -5,13 +5,14 @@ import ( "crypto/hmac" "crypto/sha256" "encoding/hex" - regexp "github.com/wasilibs/go-re2" "net/http" "net/url" "strconv" "strings" "time" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -44,15 +45,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/blazemeter/blazemeter.go b/pkg/detectors/blazemeter/blazemeter.go index 615b7b5f54fe..a9c61ce408a9 100644 --- a/pkg/detectors/blazemeter/blazemeter.go +++ b/pkg/detectors/blazemeter/blazemeter.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/blitapp/blitapp.go b/pkg/detectors/blitapp/blitapp.go index 077c443a1ac4..8ccc49cab719 100644 --- a/pkg/detectors/blitapp/blitapp.go +++ b/pkg/detectors/blitapp/blitapp.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/blocknative/blocknative.go b/pkg/detectors/blocknative/blocknative.go index d65b44672639..fea4727fdbfc 100644 --- a/pkg/detectors/blocknative/blocknative.go +++ b/pkg/detectors/blocknative/blocknative.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/blogger/blogger.go b/pkg/detectors/blogger/blogger.go index a3c46155b0b5..f464b0d02098 100644 --- a/pkg/detectors/blogger/blogger.go +++ b/pkg/detectors/blogger/blogger.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bombbomb/bombbomb.go b/pkg/detectors/bombbomb/bombbomb.go index 612e39855bee..e8fab2d83e11 100644 --- a/pkg/detectors/bombbomb/bombbomb.go +++ b/pkg/detectors/bombbomb/bombbomb.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/boostnote/boostnote.go b/pkg/detectors/boostnote/boostnote.go index a6fd6363bacb..85965e7c9ab6 100644 --- a/pkg/detectors/boostnote/boostnote.go +++ b/pkg/detectors/boostnote/boostnote.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/borgbase/borgbase.go b/pkg/detectors/borgbase/borgbase.go index d44a6c06d03d..c0ab13174cfc 100644 --- a/pkg/detectors/borgbase/borgbase.go +++ b/pkg/detectors/borgbase/borgbase.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/braintreepayments/braintreepayments.go b/pkg/detectors/braintreepayments/braintreepayments.go index b156783b9505..624084e751c5 100644 --- a/pkg/detectors/braintreepayments/braintreepayments.go +++ b/pkg/detectors/braintreepayments/braintreepayments.go @@ -47,15 +47,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/brandfetch/brandfetch.go b/pkg/detectors/brandfetch/brandfetch.go index 7ad508641016..329be91f4b5d 100644 --- a/pkg/detectors/brandfetch/brandfetch.go +++ b/pkg/detectors/brandfetch/brandfetch.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/browserstack/browserstack.go b/pkg/detectors/browserstack/browserstack.go index d3f5e1930016..ffcf1b38eaf4 100644 --- a/pkg/detectors/browserstack/browserstack.go +++ b/pkg/detectors/browserstack/browserstack.go @@ -53,15 +53,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUserMatch := strings.TrimSpace(userMatch[1]) diff --git a/pkg/detectors/browshot/browshot.go b/pkg/detectors/browshot/browshot.go index f57d67819374..3812a49825e3 100644 --- a/pkg/detectors/browshot/browshot.go +++ b/pkg/detectors/browshot/browshot.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bscscan/bscscan.go b/pkg/detectors/bscscan/bscscan.go index 9051b4de0208..0b948916fb3c 100644 --- a/pkg/detectors/bscscan/bscscan.go +++ b/pkg/detectors/bscscan/bscscan.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/buddyns/buddyns.go b/pkg/detectors/buddyns/buddyns.go index df61159b671b..e4df1ef1cfee 100644 --- a/pkg/detectors/buddyns/buddyns.go +++ b/pkg/detectors/buddyns/buddyns.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/budibase/budibase.go b/pkg/detectors/budibase/budibase.go index 50b3fc19414a..0392ee706fb0 100644 --- a/pkg/detectors/budibase/budibase.go +++ b/pkg/detectors/budibase/budibase.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bugherd/bugherd.go b/pkg/detectors/bugherd/bugherd.go index cf81e1328b8c..db6047d6a579 100644 --- a/pkg/detectors/bugherd/bugherd.go +++ b/pkg/detectors/bugherd/bugherd.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bugsnag/bugsnag.go b/pkg/detectors/bugsnag/bugsnag.go index 11e2f63c18d5..ded71337a251 100644 --- a/pkg/detectors/bugsnag/bugsnag.go +++ b/pkg/detectors/bugsnag/bugsnag.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/buildkite/buildkite.go b/pkg/detectors/buildkite/buildkite.go index 92bd1a5a7a22..b106d3b7a209 100644 --- a/pkg/detectors/buildkite/buildkite.go +++ b/pkg/detectors/buildkite/buildkite.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/buildkitev2/buildkite.go b/pkg/detectors/buildkitev2/buildkite.go index 54b98106e8d7..0a6083fd50e6 100644 --- a/pkg/detectors/buildkitev2/buildkite.go +++ b/pkg/detectors/buildkitev2/buildkite.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bulbul/bulbul.go b/pkg/detectors/bulbul/bulbul.go index a3fc6c92c828..2d652192a337 100644 --- a/pkg/detectors/bulbul/bulbul.go +++ b/pkg/detectors/bulbul/bulbul.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/bulksms/bulksms.go b/pkg/detectors/bulksms/bulksms.go index 632fd40b9111..4410b4bc75a1 100644 --- a/pkg/detectors/bulksms/bulksms.go +++ b/pkg/detectors/bulksms/bulksms.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idMatches { - if len(match) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/buttercms/buttercms.go b/pkg/detectors/buttercms/buttercms.go index 4910eec60ce2..1cbce8170fad 100644 --- a/pkg/detectors/buttercms/buttercms.go +++ b/pkg/detectors/buttercms/buttercms.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/caflou/caflou.go b/pkg/detectors/caflou/caflou.go index c831d56f5d24..93665a3e0cbd 100644 --- a/pkg/detectors/caflou/caflou.go +++ b/pkg/detectors/caflou/caflou.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/calendarific/calendarific.go b/pkg/detectors/calendarific/calendarific.go index 7930c68ee2fa..13fc48592e65 100644 --- a/pkg/detectors/calendarific/calendarific.go +++ b/pkg/detectors/calendarific/calendarific.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/calendlyapikey/calendlyapikey.go b/pkg/detectors/calendlyapikey/calendlyapikey.go index 4428bb4a576a..aa00157541d0 100644 --- a/pkg/detectors/calendlyapikey/calendlyapikey.go +++ b/pkg/detectors/calendlyapikey/calendlyapikey.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/calorieninja/calorieninja.go b/pkg/detectors/calorieninja/calorieninja.go index 7019d224a36a..5515eeedb8c7 100644 --- a/pkg/detectors/calorieninja/calorieninja.go +++ b/pkg/detectors/calorieninja/calorieninja.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/campayn/campayn.go b/pkg/detectors/campayn/campayn.go index 4f6838bd6692..a1915b247284 100644 --- a/pkg/detectors/campayn/campayn.go +++ b/pkg/detectors/campayn/campayn.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cannyio/cannyio.go b/pkg/detectors/cannyio/cannyio.go index 0a5631e8798e..a2ece4752ce5 100644 --- a/pkg/detectors/cannyio/cannyio.go +++ b/pkg/detectors/cannyio/cannyio.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/capsulecrm/capsulecrm.go b/pkg/detectors/capsulecrm/capsulecrm.go index ca631f4ddc03..3a2f82baebbb 100644 --- a/pkg/detectors/capsulecrm/capsulecrm.go +++ b/pkg/detectors/capsulecrm/capsulecrm.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/captaindata/captaindata.go b/pkg/detectors/captaindata/captaindata.go index 82b0b2abb108..ca24c635ebf6 100644 --- a/pkg/detectors/captaindata/captaindata.go +++ b/pkg/detectors/captaindata/captaindata.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result projIdMatches := projIdPat.FindAllStringSubmatch(dataStr, -1) for _, projIdMatch := range projIdMatches { - if len(projIdMatch) != 2 { - continue - } resProjIdMatch := strings.TrimSpace(projIdMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/carboninterface/carboninterface.go b/pkg/detectors/carboninterface/carboninterface.go index 0b0b69c5d2d2..801190e72f96 100644 --- a/pkg/detectors/carboninterface/carboninterface.go +++ b/pkg/detectors/carboninterface/carboninterface.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cashboard/cashboard.go b/pkg/detectors/cashboard/cashboard.go index 5bdb9e0aa400..389f5e10595e 100644 --- a/pkg/detectors/cashboard/cashboard.go +++ b/pkg/detectors/cashboard/cashboard.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUser := strings.TrimSpace(userMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/caspio/caspio.go b/pkg/detectors/caspio/caspio.go index 6dfe2e6d2bfe..117eafa74f6a 100644 --- a/pkg/detectors/caspio/caspio.go +++ b/pkg/detectors/caspio/caspio.go @@ -3,10 +3,11 @@ package caspio import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,22 +42,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) 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 _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainMatch[1]) diff --git a/pkg/detectors/censys/censys.go b/pkg/detectors/censys/censys.go index e07ec0cce114..f82920cb8f8a 100644 --- a/pkg/detectors/censys/censys.go +++ b/pkg/detectors/censys/censys.go @@ -37,15 +37,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/centralstationcrm/centralstationcrm.go b/pkg/detectors/centralstationcrm/centralstationcrm.go index 72b3f78ca489..bc4cef8df95f 100644 --- a/pkg/detectors/centralstationcrm/centralstationcrm.go +++ b/pkg/detectors/centralstationcrm/centralstationcrm.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cexio/cexio.go b/pkg/detectors/cexio/cexio.go index 5821ae8a67c2..47b849e52bcf 100644 --- a/pkg/detectors/cexio/cexio.go +++ b/pkg/detectors/cexio/cexio.go @@ -48,21 +48,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userIdMatches := userIdPat.FindAllStringSubmatch(dataStr, -1) for _, userIdMatch := range userIdMatches { - if len(userIdMatch) != 2 { - continue - } resUserIdMatch := strings.TrimSpace(userIdMatch[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKeyMatch := strings.TrimSpace(keyMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/chartmogul/chartmogul.go b/pkg/detectors/chartmogul/chartmogul.go index 20e313f12448..229e2bce0b93 100644 --- a/pkg/detectors/chartmogul/chartmogul.go +++ b/pkg/detectors/chartmogul/chartmogul.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/chatbot/chatbot.go b/pkg/detectors/chatbot/chatbot.go index c71f80ca9a8c..bd2e0c3a383c 100644 --- a/pkg/detectors/chatbot/chatbot.go +++ b/pkg/detectors/chatbot/chatbot.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/chatfule/chatfule.go b/pkg/detectors/chatfule/chatfule.go index 41cdeca43b9c..77cf3864bdda 100644 --- a/pkg/detectors/chatfule/chatfule.go +++ b/pkg/detectors/chatfule/chatfule.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/checio/checio.go b/pkg/detectors/checio/checio.go index 082d1c98f2ca..4c8eef601b22 100644 --- a/pkg/detectors/checio/checio.go +++ b/pkg/detectors/checio/checio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/checklyhq/checklyhq.go b/pkg/detectors/checklyhq/checklyhq.go index 370c348caeeb..415c0c537b05 100644 --- a/pkg/detectors/checklyhq/checklyhq.go +++ b/pkg/detectors/checklyhq/checklyhq.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/checkout/checkout.go b/pkg/detectors/checkout/checkout.go index 35b11b31d63e..f91a178742a5 100644 --- a/pkg/detectors/checkout/checkout.go +++ b/pkg/detectors/checkout/checkout.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 3 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/checkvist/checkvist.go b/pkg/detectors/checkvist/checkvist.go index d35fbd4be92a..4a24a0c0d18f 100644 --- a/pkg/detectors/checkvist/checkvist.go +++ b/pkg/detectors/checkvist/checkvist.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cicero/cicero.go b/pkg/detectors/cicero/cicero.go index 7f7393415a90..47070201495e 100644 --- a/pkg/detectors/cicero/cicero.go +++ b/pkg/detectors/cicero/cicero.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clarifai/clarifai.go b/pkg/detectors/clarifai/clarifai.go index b9885a4094e5..7a3151b1738f 100644 --- a/pkg/detectors/clarifai/clarifai.go +++ b/pkg/detectors/clarifai/clarifai.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clearbit/clearbit.go b/pkg/detectors/clearbit/clearbit.go index 469ba200ee54..a1b498356ac9 100644 --- a/pkg/detectors/clearbit/clearbit.go +++ b/pkg/detectors/clearbit/clearbit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clickhelp/clickhelp.go b/pkg/detectors/clickhelp/clickhelp.go index 42267d49d7c0..37375f65c533 100644 --- a/pkg/detectors/clickhelp/clickhelp.go +++ b/pkg/detectors/clickhelp/clickhelp.go @@ -42,20 +42,11 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range serverMatches { - if len(match) != 2 { - continue - } resServer := strings.TrimSpace(match[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmail := strings.TrimSpace(emailMatch[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKey := strings.TrimSpace(keyMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clicksendsms/clicksendsms.go b/pkg/detectors/clicksendsms/clicksendsms.go index d8574775e33f..b9be3205106d 100644 --- a/pkg/detectors/clicksendsms/clicksendsms.go +++ b/pkg/detectors/clicksendsms/clicksendsms.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { resIdMatch := strings.TrimSpace(idMatch[0][strings.LastIndex(idMatch[0], " ")+1:]) diff --git a/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go b/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go index d8058fbd3d66..a8bd0a3f686e 100644 --- a/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go +++ b/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cliengo/cliengo.go b/pkg/detectors/cliengo/cliengo.go index 6713786c7ed2..bbe40938f078 100644 --- a/pkg/detectors/cliengo/cliengo.go +++ b/pkg/detectors/cliengo/cliengo.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clinchpad/clinchpad.go b/pkg/detectors/clinchpad/clinchpad.go index e1b927a69684..44f7460e45a9 100644 --- a/pkg/detectors/clinchpad/clinchpad.go +++ b/pkg/detectors/clinchpad/clinchpad.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clockify/clockify.go b/pkg/detectors/clockify/clockify.go index 92acf73ec4af..404ade042c9d 100644 --- a/pkg/detectors/clockify/clockify.go +++ b/pkg/detectors/clockify/clockify.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clockworksms/clockworksms.go b/pkg/detectors/clockworksms/clockworksms.go index e48e1a8be40c..47ec54878678 100644 --- a/pkg/detectors/clockworksms/clockworksms.go +++ b/pkg/detectors/clockworksms/clockworksms.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result tokenMatches := tokenPat.FindAllStringSubmatch(dataStr, -1) for _, match := range userKeyMatches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, tokenMatch := range tokenMatches { - if len(tokenMatch) != 2 { - continue - } tokenRes := strings.TrimSpace(tokenMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/closecrm/close.go b/pkg/detectors/closecrm/close.go index 1bdb8ea4a26e..eaa77f264c56 100644 --- a/pkg/detectors/closecrm/close.go +++ b/pkg/detectors/closecrm/close.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudconvert/cloudconvert.go b/pkg/detectors/cloudconvert/cloudconvert.go index 8ffadc9fbf84..45637fbad6ab 100644 --- a/pkg/detectors/cloudconvert/cloudconvert.go +++ b/pkg/detectors/cloudconvert/cloudconvert.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudelements/cloudelements.go b/pkg/detectors/cloudelements/cloudelements.go index 3ba8c1e1cb0b..a7bef6bb442a 100644 --- a/pkg/detectors/cloudelements/cloudelements.go +++ b/pkg/detectors/cloudelements/cloudelements.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result orgMatches := orgPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, orgMatch := range orgMatches { - if len(orgMatch) != 2 { - continue - } resOrgMatch := strings.TrimSpace(orgMatch[1]) diff --git a/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go b/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go index 51d9ca50ef4b..f20f19c5e9f7 100644 --- a/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go +++ b/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudflarecakey/cloudflarecakey.go b/pkg/detectors/cloudflarecakey/cloudflarecakey.go index ce8703ac3816..c92315c0d9b1 100644 --- a/pkg/detectors/cloudflarecakey/cloudflarecakey.go +++ b/pkg/detectors/cloudflarecakey/cloudflarecakey.go @@ -5,10 +5,11 @@ import ( "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" - regexp "github.com/wasilibs/go-re2" ) type Scanner struct{} @@ -35,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go b/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go index 7e364a43af36..75f4ee9e7d1b 100644 --- a/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go +++ b/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go @@ -43,15 +43,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, apiKeyMatch := range apiKeyMatches { - if len(apiKeyMatch) != 2 { - continue - } apiKeyRes := strings.TrimSpace(apiKeyMatch[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } emailRes := strings.TrimSpace(emailMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudimage/cloudimage.go b/pkg/detectors/cloudimage/cloudimage.go index 7bd518913e32..f0773d8d28c0 100644 --- a/pkg/detectors/cloudimage/cloudimage.go +++ b/pkg/detectors/cloudimage/cloudimage.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudmersive/cloudmersive.go b/pkg/detectors/cloudmersive/cloudmersive.go index 4a2d5e0b5173..93b575dba024 100644 --- a/pkg/detectors/cloudmersive/cloudmersive.go +++ b/pkg/detectors/cloudmersive/cloudmersive.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudplan/cloudplan.go b/pkg/detectors/cloudplan/cloudplan.go index 30ac902b4ca5..a95b0d4860d0 100644 --- a/pkg/detectors/cloudplan/cloudplan.go +++ b/pkg/detectors/cloudplan/cloudplan.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloudsmith/cloudsmith.go b/pkg/detectors/cloudsmith/cloudsmith.go index 953f65840e05..75973d73776b 100644 --- a/pkg/detectors/cloudsmith/cloudsmith.go +++ b/pkg/detectors/cloudsmith/cloudsmith.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloverly/cloverly.go b/pkg/detectors/cloverly/cloverly.go index 8793d84e88eb..4062ab30a36a 100644 --- a/pkg/detectors/cloverly/cloverly.go +++ b/pkg/detectors/cloverly/cloverly.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cloze/cloze.go b/pkg/detectors/cloze/cloze.go index 3e90294b426d..b6b6fe258e47 100644 --- a/pkg/detectors/cloze/cloze.go +++ b/pkg/detectors/cloze/cloze.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/clustdoc/clustdoc.go b/pkg/detectors/clustdoc/clustdoc.go index 0ec9ab16a7a4..25d569406f21 100644 --- a/pkg/detectors/clustdoc/clustdoc.go +++ b/pkg/detectors/clustdoc/clustdoc.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coda/coda.go b/pkg/detectors/coda/coda.go index 2b0fa89837cc..82dd6ac6a38f 100644 --- a/pkg/detectors/coda/coda.go +++ b/pkg/detectors/coda/coda.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/codacy/codacy.go b/pkg/detectors/codacy/codacy.go index 13326f54012f..2bc1642c148b 100644 --- a/pkg/detectors/codacy/codacy.go +++ b/pkg/detectors/codacy/codacy.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/codeclimate/codeclimate.go b/pkg/detectors/codeclimate/codeclimate.go index 52f1f739b93c..d54ee02589c2 100644 --- a/pkg/detectors/codeclimate/codeclimate.go +++ b/pkg/detectors/codeclimate/codeclimate.go @@ -44,9 +44,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/codemagic/codemagic.go b/pkg/detectors/codemagic/codemagic.go index 4ab971d0bf86..2caa39112d6e 100644 --- a/pkg/detectors/codemagic/codemagic.go +++ b/pkg/detectors/codemagic/codemagic.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/codequiry/codequiry.go b/pkg/detectors/codequiry/codequiry.go index a16a9ef3ee20..ee1a64a61d8a 100644 --- a/pkg/detectors/codequiry/codequiry.go +++ b/pkg/detectors/codequiry/codequiry.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coinapi/coinapi.go b/pkg/detectors/coinapi/coinapi.go index 52eaa9313c55..ebf026dfcabd 100644 --- a/pkg/detectors/coinapi/coinapi.go +++ b/pkg/detectors/coinapi/coinapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coinbase/coinbase.go b/pkg/detectors/coinbase/coinbase.go index bc93208a68bb..ada6fc741003 100644 --- a/pkg/detectors/coinbase/coinbase.go +++ b/pkg/detectors/coinbase/coinbase.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coinlayer/coinlayer.go b/pkg/detectors/coinlayer/coinlayer.go index 0fa4cd0d1719..e8309a204913 100644 --- a/pkg/detectors/coinlayer/coinlayer.go +++ b/pkg/detectors/coinlayer/coinlayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coinlib/coinlib.go b/pkg/detectors/coinlib/coinlib.go index 383fc419b53a..f18e7c440632 100644 --- a/pkg/detectors/coinlib/coinlib.go +++ b/pkg/detectors/coinlib/coinlib.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/collect2/collect2.go b/pkg/detectors/collect2/collect2.go index 8ad52883b3f8..29173c948003 100644 --- a/pkg/detectors/collect2/collect2.go +++ b/pkg/detectors/collect2/collect2.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/column/column.go b/pkg/detectors/column/column.go index b8bf106b256a..7bcd6ad95c04 100644 --- a/pkg/detectors/column/column.go +++ b/pkg/detectors/column/column.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/commercejs/commercejs.go b/pkg/detectors/commercejs/commercejs.go index c77bc80ae0f9..6b77919c101a 100644 --- a/pkg/detectors/commercejs/commercejs.go +++ b/pkg/detectors/commercejs/commercejs.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/commodities/commodities.go b/pkg/detectors/commodities/commodities.go index 126215fe0ea2..8f242c4acdf6 100644 --- a/pkg/detectors/commodities/commodities.go +++ b/pkg/detectors/commodities/commodities.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/companyhub/companyhub.go b/pkg/detectors/companyhub/companyhub.go index d79e32704a40..b367ea3d023a 100644 --- a/pkg/detectors/companyhub/companyhub.go +++ b/pkg/detectors/companyhub/companyhub.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/confluent/confluent.go b/pkg/detectors/confluent/confluent.go index b6a07eb82f13..c64c42a39588 100644 --- a/pkg/detectors/confluent/confluent.go +++ b/pkg/detectors/confluent/confluent.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secret := range secretMatches { - if len(secret) != 2 { - continue - } resSecret := strings.TrimSpace(secret[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go b/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go index b75ace2b4bb3..3ac8b1862593 100644 --- a/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go +++ b/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go @@ -3,10 +3,11 @@ package contentfulpersonalaccesstoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -35,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range keyMatches { - if len(match) != 2 { - continue - } keyRes := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/conversiontools/conversiontools.go b/pkg/detectors/conversiontools/conversiontools.go index 27b42823a03a..f08b5f6d28de 100644 --- a/pkg/detectors/conversiontools/conversiontools.go +++ b/pkg/detectors/conversiontools/conversiontools.go @@ -3,10 +3,11 @@ package conversiontools import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/convertapi/convertapi.go b/pkg/detectors/convertapi/convertapi.go index 8e443bfffef9..114e28e7a0c4 100644 --- a/pkg/detectors/convertapi/convertapi.go +++ b/pkg/detectors/convertapi/convertapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/convertkit/convertkit.go b/pkg/detectors/convertkit/convertkit.go index 3417dabe5e3b..ffa7d2be121e 100644 --- a/pkg/detectors/convertkit/convertkit.go +++ b/pkg/detectors/convertkit/convertkit.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/convier/convier.go b/pkg/detectors/convier/convier.go index ff17d32b51ae..b4eada75c9e7 100644 --- a/pkg/detectors/convier/convier.go +++ b/pkg/detectors/convier/convier.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/copper/copper.go b/pkg/detectors/copper/copper.go index 6d1dc61cc200..b240820b4a78 100644 --- a/pkg/detectors/copper/copper.go +++ b/pkg/detectors/copper/copper.go @@ -38,14 +38,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/countrylayer/countrylayer.go b/pkg/detectors/countrylayer/countrylayer.go index 36a872b0d5a8..3938fd90a9b2 100644 --- a/pkg/detectors/countrylayer/countrylayer.go +++ b/pkg/detectors/countrylayer/countrylayer.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/courier/courier.go b/pkg/detectors/courier/courier.go index 0519a0334b28..b13e3fd2c0f2 100644 --- a/pkg/detectors/courier/courier.go +++ b/pkg/detectors/courier/courier.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/coveralls/coveralls.go b/pkg/detectors/coveralls/coveralls.go index 164c47af5bdb..94186eb38517 100644 --- a/pkg/detectors/coveralls/coveralls.go +++ b/pkg/detectors/coveralls/coveralls.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/craftmypdf/craftmypdf.go b/pkg/detectors/craftmypdf/craftmypdf.go index 36482c0233e4..6bb77c23fb18 100644 --- a/pkg/detectors/craftmypdf/craftmypdf.go +++ b/pkg/detectors/craftmypdf/craftmypdf.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/crowdin/crowdin.go b/pkg/detectors/crowdin/crowdin.go index 8a13a3b6c20e..66737709af1f 100644 --- a/pkg/detectors/crowdin/crowdin.go +++ b/pkg/detectors/crowdin/crowdin.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/cryptocompare/cryptocompare.go b/pkg/detectors/cryptocompare/cryptocompare.go index 262e6234664f..20ef6e88bc58 100644 --- a/pkg/detectors/cryptocompare/cryptocompare.go +++ b/pkg/detectors/cryptocompare/cryptocompare.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currencycloud/currencycloud.go b/pkg/detectors/currencycloud/currencycloud.go index 63617a191b48..86eb06c2e0f9 100644 --- a/pkg/detectors/currencycloud/currencycloud.go +++ b/pkg/detectors/currencycloud/currencycloud.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, emailmatch := range emailMatches { - if len(emailmatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currencyfreaks/currencyfreaks.go b/pkg/detectors/currencyfreaks/currencyfreaks.go index 4465a51ba33d..69ac6bbe4d8e 100644 --- a/pkg/detectors/currencyfreaks/currencyfreaks.go +++ b/pkg/detectors/currencyfreaks/currencyfreaks.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currencylayer/currencylayer.go b/pkg/detectors/currencylayer/currencylayer.go index a8a1a1ded406..262128bcd469 100644 --- a/pkg/detectors/currencylayer/currencylayer.go +++ b/pkg/detectors/currencylayer/currencylayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currencyscoop/currencyscoop.go b/pkg/detectors/currencyscoop/currencyscoop.go index 1ae2615144c5..4cd3ce5da3e1 100644 --- a/pkg/detectors/currencyscoop/currencyscoop.go +++ b/pkg/detectors/currencyscoop/currencyscoop.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/currentsapi/currentsapi.go b/pkg/detectors/currentsapi/currentsapi.go index 093d6c35187b..2a06b8d61707 100644 --- a/pkg/detectors/currentsapi/currentsapi.go +++ b/pkg/detectors/currentsapi/currentsapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/customerguru/customerguru.go b/pkg/detectors/customerguru/customerguru.go index 8d339794f089..bf2dd750a8a9 100644 --- a/pkg/detectors/customerguru/customerguru.go +++ b/pkg/detectors/customerguru/customerguru.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/customerio/customerio.go b/pkg/detectors/customerio/customerio.go index 4dc8036b4731..d432c01bc442 100644 --- a/pkg/detectors/customerio/customerio.go +++ b/pkg/detectors/customerio/customerio.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_CustomerIO, diff --git a/pkg/detectors/d7network/d7network.go b/pkg/detectors/d7network/d7network.go index 2cdfa8c406ba..1be55898e80e 100644 --- a/pkg/detectors/d7network/d7network.go +++ b/pkg/detectors/d7network/d7network.go @@ -33,9 +33,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dailyco/dailyco.go b/pkg/detectors/dailyco/dailyco.go index 54bd589ddeeb..779e88cd61c4 100644 --- a/pkg/detectors/dailyco/dailyco.go +++ b/pkg/detectors/dailyco/dailyco.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dandelion/dandelion.go b/pkg/detectors/dandelion/dandelion.go index 32878c5dc3af..2092e71cdebb 100644 --- a/pkg/detectors/dandelion/dandelion.go +++ b/pkg/detectors/dandelion/dandelion.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dareboost/dareboost.go b/pkg/detectors/dareboost/dareboost.go index 02fdf791e66e..4124d3fbd245 100644 --- a/pkg/detectors/dareboost/dareboost.go +++ b/pkg/detectors/dareboost/dareboost.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/databox/databox.go b/pkg/detectors/databox/databox.go index e6e250e82d31..a4e3cb50da94 100644 --- a/pkg/detectors/databox/databox.go +++ b/pkg/detectors/databox/databox.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/datadogtoken/datadogtoken.go b/pkg/detectors/datadogtoken/datadogtoken.go index af2c8f0cfba4..96673224795c 100644 --- a/pkg/detectors/datadogtoken/datadogtoken.go +++ b/pkg/detectors/datadogtoken/datadogtoken.go @@ -44,15 +44,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result apiMatches := apiPat.FindAllStringSubmatch(dataStr, -1) for _, apiMatch := range apiMatches { - if len(apiMatch) != 2 { - continue - } resApiMatch := strings.TrimSpace(apiMatch[1]) appIncluded := false for _, appMatch := range appMatches { - if len(appMatch) != 2 { - continue - } resAppMatch := strings.TrimSpace(appMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/datagov/datagov.go b/pkg/detectors/datagov/datagov.go index eb927a30fe10..4450f7dff904 100644 --- a/pkg/detectors/datagov/datagov.go +++ b/pkg/detectors/datagov/datagov.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/debounce/debounce.go b/pkg/detectors/debounce/debounce.go index dffcbaf7f282..dd129a8b2c4a 100644 --- a/pkg/detectors/debounce/debounce.go +++ b/pkg/detectors/debounce/debounce.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/deepai/deepai.go b/pkg/detectors/deepai/deepai.go index 335e77847e3a..dbea07c5d9b5 100644 --- a/pkg/detectors/deepai/deepai.go +++ b/pkg/detectors/deepai/deepai.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/deepgram/deepgram.go b/pkg/detectors/deepgram/deepgram.go index b0f42c8523e6..5e8cc18256f0 100644 --- a/pkg/detectors/deepgram/deepgram.go +++ b/pkg/detectors/deepgram/deepgram.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/delighted/delighted.go b/pkg/detectors/delighted/delighted.go index bcc49126704a..ad1d613c6020 100644 --- a/pkg/detectors/delighted/delighted.go +++ b/pkg/detectors/delighted/delighted.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/demio/demio.go b/pkg/detectors/demio/demio.go index e1b4a7046e5b..20639cca9016 100644 --- a/pkg/detectors/demio/demio.go +++ b/pkg/detectors/demio/demio.go @@ -38,14 +38,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) idMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idMatches { - if len(match) != 2 { - continue - } resIdMatch := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/deputy/deputy.go b/pkg/detectors/deputy/deputy.go index e0d23f4d9ee1..b9c7b0979837 100644 --- a/pkg/detectors/deputy/deputy.go +++ b/pkg/detectors/deputy/deputy.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/detectify/detectify.go b/pkg/detectors/detectify/detectify.go index 07258812c84d..7f7c8fd504a8 100644 --- a/pkg/detectors/detectify/detectify.go +++ b/pkg/detectors/detectify/detectify.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/detectlanguage/detectlanguage.go b/pkg/detectors/detectlanguage/detectlanguage.go index 214c75743ec8..517d940b0a99 100644 --- a/pkg/detectors/detectlanguage/detectlanguage.go +++ b/pkg/detectors/detectlanguage/detectlanguage.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dfuse/dfuse.go b/pkg/detectors/dfuse/dfuse.go index 08777a70f5d9..24861a6fd2ee 100644 --- a/pkg/detectors/dfuse/dfuse.go +++ b/pkg/detectors/dfuse/dfuse.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/diffbot/diffbot.go b/pkg/detectors/diffbot/diffbot.go index e4e7197c5c69..e8df050c82a1 100644 --- a/pkg/detectors/diffbot/diffbot.go +++ b/pkg/detectors/diffbot/diffbot.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/diggernaut/diggernaut.go b/pkg/detectors/diggernaut/diggernaut.go index 221cd5c25523..13fb5ec543ad 100644 --- a/pkg/detectors/diggernaut/diggernaut.go +++ b/pkg/detectors/diggernaut/diggernaut.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/digitaloceantoken/digitaloceantoken.go b/pkg/detectors/digitaloceantoken/digitaloceantoken.go index e866c71d9027..24e2c4c84ce6 100644 --- a/pkg/detectors/digitaloceantoken/digitaloceantoken.go +++ b/pkg/detectors/digitaloceantoken/digitaloceantoken.go @@ -3,10 +3,11 @@ package digitaloceantoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/digitaloceanv2/digitaloceanv2.go b/pkg/detectors/digitaloceanv2/digitaloceanv2.go index 81e3610c024e..dae4ff734ca2 100644 --- a/pkg/detectors/digitaloceanv2/digitaloceanv2.go +++ b/pkg/detectors/digitaloceanv2/digitaloceanv2.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/discordbottoken/discordbottoken.go b/pkg/detectors/discordbottoken/discordbottoken.go index bee617a07703..294601d0de04 100644 --- a/pkg/detectors/discordbottoken/discordbottoken.go +++ b/pkg/detectors/discordbottoken/discordbottoken.go @@ -3,10 +3,11 @@ package discordbottoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatch := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idmatch := range idMatch { - if len(match) != 2 { - continue - } resId := strings.TrimSpace(idmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_DiscordBotToken, diff --git a/pkg/detectors/discordwebhook/discordwebhook.go b/pkg/detectors/discordwebhook/discordwebhook.go index 8994363243a7..e5ee928b1203 100644 --- a/pkg/detectors/discordwebhook/discordwebhook.go +++ b/pkg/detectors/discordwebhook/discordwebhook.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_DiscordWebhook, diff --git a/pkg/detectors/disqus/disqus.go b/pkg/detectors/disqus/disqus.go index e8635f3b00e6..a62873b239e8 100644 --- a/pkg/detectors/disqus/disqus.go +++ b/pkg/detectors/disqus/disqus.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ditto/ditto.go b/pkg/detectors/ditto/ditto.go index c2def8852b33..8a567d9c1a1a 100644 --- a/pkg/detectors/ditto/ditto.go +++ b/pkg/detectors/ditto/ditto.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dnscheck/dnscheck.go b/pkg/detectors/dnscheck/dnscheck.go index bd744c76a9d7..3e38ac1aaa6d 100644 --- a/pkg/detectors/dnscheck/dnscheck.go +++ b/pkg/detectors/dnscheck/dnscheck.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/docparser/docparser.go b/pkg/detectors/docparser/docparser.go index 96cb6dc0567a..32a856eb39da 100644 --- a/pkg/detectors/docparser/docparser.go +++ b/pkg/detectors/docparser/docparser.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/documo/documo.go b/pkg/detectors/documo/documo.go index d24fd223adb4..41b49231301a 100644 --- a/pkg/detectors/documo/documo.go +++ b/pkg/detectors/documo/documo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/docusign/docusign.go b/pkg/detectors/docusign/docusign.go index b748490b8818..c3a50d593ba4 100644 --- a/pkg/detectors/docusign/docusign.go +++ b/pkg/detectors/docusign/docusign.go @@ -45,15 +45,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIDMatch := strings.TrimSpace(idMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/doppler/doppler.go b/pkg/detectors/doppler/doppler.go index 3bca3506e739..09942a19a265 100644 --- a/pkg/detectors/doppler/doppler.go +++ b/pkg/detectors/doppler/doppler.go @@ -54,9 +54,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dotmailer/dotmailer.go b/pkg/detectors/dotmailer/dotmailer.go index b85d71897eba..075f75436f61 100644 --- a/pkg/detectors/dotmailer/dotmailer.go +++ b/pkg/detectors/dotmailer/dotmailer.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passMatches := passPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range passMatches { - if len(idMatch) != 2 { - continue - } resPassMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/dovico/dovico.go b/pkg/detectors/dovico/dovico.go index 555f4a7c114c..b71beb073235 100644 --- a/pkg/detectors/dovico/dovico.go +++ b/pkg/detectors/dovico/dovico.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, user := range userMatches { - if len(user) != 2 { - continue - } resUser := strings.TrimSpace(user[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dronahq/dronahq.go b/pkg/detectors/dronahq/dronahq.go index b2c813bcaf0d..b74a5d5757a6 100644 --- a/pkg/detectors/dronahq/dronahq.go +++ b/pkg/detectors/dronahq/dronahq.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/droneci/droneci.go b/pkg/detectors/droneci/droneci.go index 99fb8ece756d..0632c1ae4db2 100644 --- a/pkg/detectors/droneci/droneci.go +++ b/pkg/detectors/droneci/droneci.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/duply/duply.go b/pkg/detectors/duply/duply.go index 3b2d94ccc526..f8955da53041 100644 --- a/pkg/detectors/duply/duply.go +++ b/pkg/detectors/duply/duply.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/dwolla/dwolla.go b/pkg/detectors/dwolla/dwolla.go index 41aa420ffc2f..fefda9b6cc33 100644 --- a/pkg/detectors/dwolla/dwolla.go +++ b/pkg/detectors/dwolla/dwolla.go @@ -40,16 +40,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } idMatch := strings.TrimSpace(match[1]) for _, secret := range secretMatches { - if len(secret) != 2 { - continue - } secretMatch := strings.TrimSpace(secret[1]) diff --git a/pkg/detectors/dynalist/dynalist.go b/pkg/detectors/dynalist/dynalist.go index 03af2edc191b..c18d6c2524e0 100644 --- a/pkg/detectors/dynalist/dynalist.go +++ b/pkg/detectors/dynalist/dynalist.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/dyspatch/dyspatch.go b/pkg/detectors/dyspatch/dyspatch.go index b51ea74493e1..3bca9c46168d 100644 --- a/pkg/detectors/dyspatch/dyspatch.go +++ b/pkg/detectors/dyspatch/dyspatch.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go b/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go index 576030c2ff70..cf1f3d3c562c 100644 --- a/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go +++ b/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go @@ -3,10 +3,11 @@ package eagleeyenetworks import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) emailMatches := email.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmailPatMatch := strings.TrimSpace(emailMatch[1]) diff --git a/pkg/detectors/easyinsight/easyinsight.go b/pkg/detectors/easyinsight/easyinsight.go index dfab594f3d02..b64b492cf0d1 100644 --- a/pkg/detectors/easyinsight/easyinsight.go +++ b/pkg/detectors/easyinsight/easyinsight.go @@ -41,14 +41,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/ecostruxureit/ecostruxureit.go b/pkg/detectors/ecostruxureit/ecostruxureit.go index c3d3b9e548d6..f6ae5a9ae2ef 100644 --- a/pkg/detectors/ecostruxureit/ecostruxureit.go +++ b/pkg/detectors/ecostruxureit/ecostruxureit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/edamam/edamam.go b/pkg/detectors/edamam/edamam.go index 9ed2f5bd3ea8..e479088ef809 100644 --- a/pkg/detectors/edamam/edamam.go +++ b/pkg/detectors/edamam/edamam.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(match) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Edamam, diff --git a/pkg/detectors/edenai/edenai.go b/pkg/detectors/edenai/edenai.go index 2d1a2d5c7099..86c7ad4a0234 100644 --- a/pkg/detectors/edenai/edenai.go +++ b/pkg/detectors/edenai/edenai.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/eightxeight/eightxeight.go b/pkg/detectors/eightxeight/eightxeight.go index c2965149ba0f..a3fc825ae885 100644 --- a/pkg/detectors/eightxeight/eightxeight.go +++ b/pkg/detectors/eightxeight/eightxeight.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) diff --git a/pkg/detectors/elasticemail/elasticemail.go b/pkg/detectors/elasticemail/elasticemail.go index 1a287cef0f94..40c77c466827 100644 --- a/pkg/detectors/elasticemail/elasticemail.go +++ b/pkg/detectors/elasticemail/elasticemail.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/enablex/enablex.go b/pkg/detectors/enablex/enablex.go index cdfc0d598f02..adc4995edab2 100644 --- a/pkg/detectors/enablex/enablex.go +++ b/pkg/detectors/enablex/enablex.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/enigma/enigma.go b/pkg/detectors/enigma/enigma.go index c58463cb0351..fa92ffc1177d 100644 --- a/pkg/detectors/enigma/enigma.go +++ b/pkg/detectors/enigma/enigma.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/envoyapikey/envoyapikey.go b/pkg/detectors/envoyapikey/envoyapikey.go index 9279344ae5cd..f74b5c31c93c 100644 --- a/pkg/detectors/envoyapikey/envoyapikey.go +++ b/pkg/detectors/envoyapikey/envoyapikey.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/etherscan/etherscan.go b/pkg/detectors/etherscan/etherscan.go index 11e375fa94a8..a6a3a342eedd 100644 --- a/pkg/detectors/etherscan/etherscan.go +++ b/pkg/detectors/etherscan/etherscan.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ethplorer/ethplorer.go b/pkg/detectors/ethplorer/ethplorer.go index 5731ae2464e1..ceeadfdd8689 100644 --- a/pkg/detectors/ethplorer/ethplorer.go +++ b/pkg/detectors/ethplorer/ethplorer.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/eventbrite/eventbrite.go b/pkg/detectors/eventbrite/eventbrite.go index dfbfbdd67ed0..c2816d184ba5 100644 --- a/pkg/detectors/eventbrite/eventbrite.go +++ b/pkg/detectors/eventbrite/eventbrite.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/everhour/everhour.go b/pkg/detectors/everhour/everhour.go index 6e34783b507b..e7164812c72d 100644 --- a/pkg/detectors/everhour/everhour.go +++ b/pkg/detectors/everhour/everhour.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/exchangerateapi/exchangerateapi.go b/pkg/detectors/exchangerateapi/exchangerateapi.go index 7598278585e6..db9c5e1f24c4 100644 --- a/pkg/detectors/exchangerateapi/exchangerateapi.go +++ b/pkg/detectors/exchangerateapi/exchangerateapi.go @@ -3,10 +3,11 @@ package exchangerateapi import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/exchangeratesapi/exchangeratesapi.go b/pkg/detectors/exchangeratesapi/exchangeratesapi.go index 8c3ae9565213..08de4cfb6e63 100644 --- a/pkg/detectors/exchangeratesapi/exchangeratesapi.go +++ b/pkg/detectors/exchangeratesapi/exchangeratesapi.go @@ -3,10 +3,11 @@ package exchangeratesapi import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/exportsdk/exportsdk.go b/pkg/detectors/exportsdk/exportsdk.go index 71233c87bae5..4468bc9a55d2 100644 --- a/pkg/detectors/exportsdk/exportsdk.go +++ b/pkg/detectors/exportsdk/exportsdk.go @@ -38,14 +38,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/extractorapi/extractorapi.go b/pkg/detectors/extractorapi/extractorapi.go index b00e37390747..f0a8d5a079aa 100644 --- a/pkg/detectors/extractorapi/extractorapi.go +++ b/pkg/detectors/extractorapi/extractorapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/facebookoauth/facebookoauth.go b/pkg/detectors/facebookoauth/facebookoauth.go index fc727e98a75b..3bf4a8220fdd 100644 --- a/pkg/detectors/facebookoauth/facebookoauth.go +++ b/pkg/detectors/facebookoauth/facebookoauth.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result apiSecretMatches := apiSecretPat.FindAllStringSubmatch(dataStr, -1) for _, apiIdMatch := range apiIdMatches { - if len(apiIdMatch) != 2 { - continue - } apiIdRes := strings.TrimSpace(apiIdMatch[1]) for _, apiSecretMatch := range apiSecretMatches { - if len(apiSecretMatch) != 2 { - continue - } apiSecretRes := strings.TrimSpace(apiSecretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/faceplusplus/faceplusplus.go b/pkg/detectors/faceplusplus/faceplusplus.go index cf17155cb7a6..ae0c4f08a07e 100644 --- a/pkg/detectors/faceplusplus/faceplusplus.go +++ b/pkg/detectors/faceplusplus/faceplusplus.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fastforex/fastforex.go b/pkg/detectors/fastforex/fastforex.go index f4373dc2c512..a1acdc0c2ff7 100644 --- a/pkg/detectors/fastforex/fastforex.go +++ b/pkg/detectors/fastforex/fastforex.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go b/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go index 8981db540044..cd96c3cb9f16 100644 --- a/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go +++ b/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go @@ -4,11 +4,12 @@ import ( "context" "encoding/json" "fmt" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -46,9 +47,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/feedier/feedier.go b/pkg/detectors/feedier/feedier.go index 01a58d975cc6..ff926807399f 100644 --- a/pkg/detectors/feedier/feedier.go +++ b/pkg/detectors/feedier/feedier.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fetchrss/fetchrss.go b/pkg/detectors/fetchrss/fetchrss.go index 38b036dea0c0..910e1221174f 100644 --- a/pkg/detectors/fetchrss/fetchrss.go +++ b/pkg/detectors/fetchrss/fetchrss.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fibery/fibery.go b/pkg/detectors/fibery/fibery.go index 5f268343aeba..50285663858e 100644 --- a/pkg/detectors/fibery/fibery.go +++ b/pkg/detectors/fibery/fibery.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainMatch[1]) diff --git a/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go b/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go index 4546e1705602..121b02e4e517 100644 --- a/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go +++ b/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go b/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go index da23c49ded8a..5dbad5ee16d4 100644 --- a/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go +++ b/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fileio/fileio.go b/pkg/detectors/fileio/fileio.go index 5d1fae8c267f..5da6732581d1 100644 --- a/pkg/detectors/fileio/fileio.go +++ b/pkg/detectors/fileio/fileio.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/finage/finage.go b/pkg/detectors/finage/finage.go index bd0dca0fa49d..7648179d7739 100644 --- a/pkg/detectors/finage/finage.go +++ b/pkg/detectors/finage/finage.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/financialmodelingprep/financialmodelingprep.go b/pkg/detectors/financialmodelingprep/financialmodelingprep.go index 5783c15a9852..0c2d7c421255 100644 --- a/pkg/detectors/financialmodelingprep/financialmodelingprep.go +++ b/pkg/detectors/financialmodelingprep/financialmodelingprep.go @@ -3,11 +3,12 @@ package financialmodelingprep import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/findl/findl.go b/pkg/detectors/findl/findl.go index 921c98596baa..ccf056657ad6 100644 --- a/pkg/detectors/findl/findl.go +++ b/pkg/detectors/findl/findl.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/finnhub/finnhub.go b/pkg/detectors/finnhub/finnhub.go index 3d542973390e..aa0e89d8ff85 100644 --- a/pkg/detectors/finnhub/finnhub.go +++ b/pkg/detectors/finnhub/finnhub.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fixerio/fixerio.go b/pkg/detectors/fixerio/fixerio.go index e2a77bbd3e59..d440cb121401 100644 --- a/pkg/detectors/fixerio/fixerio.go +++ b/pkg/detectors/fixerio/fixerio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flatio/flatio.go b/pkg/detectors/flatio/flatio.go index 4743b2996517..206825a9d7ec 100644 --- a/pkg/detectors/flatio/flatio.go +++ b/pkg/detectors/flatio/flatio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fleetbase/fleetbase.go b/pkg/detectors/fleetbase/fleetbase.go index 05e7bb12b4a7..a3d855513b0d 100644 --- a/pkg/detectors/fleetbase/fleetbase.go +++ b/pkg/detectors/fleetbase/fleetbase.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flickr/flickr.go b/pkg/detectors/flickr/flickr.go index 5049678c1993..609aaedf9499 100644 --- a/pkg/detectors/flickr/flickr.go +++ b/pkg/detectors/flickr/flickr.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flightapi/flightapi.go b/pkg/detectors/flightapi/flightapi.go index 90bb89d5ef24..bf8ebbfec0d6 100644 --- a/pkg/detectors/flightapi/flightapi.go +++ b/pkg/detectors/flightapi/flightapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flightlabs/flightlabs.go b/pkg/detectors/flightlabs/flightlabs.go index 230321d85171..575853ca93a8 100644 --- a/pkg/detectors/flightlabs/flightlabs.go +++ b/pkg/detectors/flightlabs/flightlabs.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flightstats/flightstats.go b/pkg/detectors/flightstats/flightstats.go index b2f100e0ec8f..2a7dbe359495 100644 --- a/pkg/detectors/flightstats/flightstats.go +++ b/pkg/detectors/flightstats/flightstats.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/float/float.go b/pkg/detectors/float/float.go index cb8a0ed90a46..28d39ce6a9d6 100644 --- a/pkg/detectors/float/float.go +++ b/pkg/detectors/float/float.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/flowflu/flowflu.go b/pkg/detectors/flowflu/flowflu.go index 0116310539a3..f9d22987c62b 100644 --- a/pkg/detectors/flowflu/flowflu.go +++ b/pkg/detectors/flowflu/flowflu.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result accountMatches := accountPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, accountMatch := range accountMatches { - if len(accountMatch) != 2 { - continue - } resAccount := strings.TrimSpace(accountMatch[1]) diff --git a/pkg/detectors/flutterwave/flutterwave.go b/pkg/detectors/flutterwave/flutterwave.go index 32bc69e6d9e5..38802142c8fa 100644 --- a/pkg/detectors/flutterwave/flutterwave.go +++ b/pkg/detectors/flutterwave/flutterwave.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fmfw/fmfw.go b/pkg/detectors/fmfw/fmfw.go index e6514b1c6b83..ad92d27a381e 100644 --- a/pkg/detectors/fmfw/fmfw.go +++ b/pkg/detectors/fmfw/fmfw.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/formbucket/formbucket.go b/pkg/detectors/formbucket/formbucket.go index b3175d8c88d2..6f34faa98537 100644 --- a/pkg/detectors/formbucket/formbucket.go +++ b/pkg/detectors/formbucket/formbucket.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/formcraft/formcraft.go b/pkg/detectors/formcraft/formcraft.go index 1f09769d8f61..b5f3abaf6bd2 100644 --- a/pkg/detectors/formcraft/formcraft.go +++ b/pkg/detectors/formcraft/formcraft.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/formio/formio.go b/pkg/detectors/formio/formio.go index b562dd3ed331..e6b1ba441424 100644 --- a/pkg/detectors/formio/formio.go +++ b/pkg/detectors/formio/formio.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/formsite/formsite.go b/pkg/detectors/formsite/formsite.go index c8ef4dfa8599..25eeaaef507a 100644 --- a/pkg/detectors/formsite/formsite.go +++ b/pkg/detectors/formsite/formsite.go @@ -41,19 +41,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, serverMatch := range serverMatches { - if len(serverMatch) != 2 { - continue - } resServerMatch := strings.TrimSpace(serverMatch[1]) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUserMatch := strings.TrimSpace(userMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Formsite, diff --git a/pkg/detectors/foursquare/foursquare.go b/pkg/detectors/foursquare/foursquare.go index c5b4246946b5..6331c0adcef2 100644 --- a/pkg/detectors/foursquare/foursquare.go +++ b/pkg/detectors/foursquare/foursquare.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretMatch.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_FourSquare, diff --git a/pkg/detectors/frameio/frameio.go b/pkg/detectors/frameio/frameio.go index 80bb3f174c71..09fe6b600eb9 100644 --- a/pkg/detectors/frameio/frameio.go +++ b/pkg/detectors/frameio/frameio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/freshbooks/freshbooks.go b/pkg/detectors/freshbooks/freshbooks.go index 0aabfa8cb638..98ff6238e408 100644 --- a/pkg/detectors/freshbooks/freshbooks.go +++ b/pkg/detectors/freshbooks/freshbooks.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result uriMatches := uriPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, uriMatch := range uriMatches { - if len(uriMatch) != 2 { - continue - } resURI := strings.TrimSpace(uriMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/freshdesk/freshdesk.go b/pkg/detectors/freshdesk/freshdesk.go index 35971bfc9408..c2466dc3c179 100644 --- a/pkg/detectors/freshdesk/freshdesk.go +++ b/pkg/detectors/freshdesk/freshdesk.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Freshdesk, diff --git a/pkg/detectors/front/front.go b/pkg/detectors/front/front.go index 515322b09bca..7fe61223769d 100644 --- a/pkg/detectors/front/front.go +++ b/pkg/detectors/front/front.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fulcrum/fulcrum.go b/pkg/detectors/fulcrum/fulcrum.go index c99a2bcd870a..39a601a8b087 100644 --- a/pkg/detectors/fulcrum/fulcrum.go +++ b/pkg/detectors/fulcrum/fulcrum.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fullstory/v1/fullstory.go b/pkg/detectors/fullstory/v1/fullstory.go index d051af0b68fd..9c74acdac21d 100644 --- a/pkg/detectors/fullstory/v1/fullstory.go +++ b/pkg/detectors/fullstory/v1/fullstory.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fullstory/v2/fullstory_v2.go b/pkg/detectors/fullstory/v2/fullstory_v2.go index 0b9184d628da..5d34e0dfb9f4 100644 --- a/pkg/detectors/fullstory/v2/fullstory_v2.go +++ b/pkg/detectors/fullstory/v2/fullstory_v2.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/fxmarket/fxmarket.go b/pkg/detectors/fxmarket/fxmarket.go index 598858545797..971f790a8186 100644 --- a/pkg/detectors/fxmarket/fxmarket.go +++ b/pkg/detectors/fxmarket/fxmarket.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geckoboard/geckoboard.go b/pkg/detectors/geckoboard/geckoboard.go index 2bd56e33fe21..9ad93b925ebc 100644 --- a/pkg/detectors/geckoboard/geckoboard.go +++ b/pkg/detectors/geckoboard/geckoboard.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gemini/gemini.go b/pkg/detectors/gemini/gemini.go index 6c0828d2b890..62c3ce308653 100644 --- a/pkg/detectors/gemini/gemini.go +++ b/pkg/detectors/gemini/gemini.go @@ -52,9 +52,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { diff --git a/pkg/detectors/gengo/gengo.go b/pkg/detectors/gengo/gengo.go index cea4083cfeae..37ab56a26096 100644 --- a/pkg/detectors/gengo/gengo.go +++ b/pkg/detectors/gengo/gengo.go @@ -47,15 +47,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geoapify/geoapify.go b/pkg/detectors/geoapify/geoapify.go index 83c1d3cbca46..f44ede1b8a8e 100644 --- a/pkg/detectors/geoapify/geoapify.go +++ b/pkg/detectors/geoapify/geoapify.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geocode/geocode.go b/pkg/detectors/geocode/geocode.go index 8d4c5c068e20..053940a3fe8e 100644 --- a/pkg/detectors/geocode/geocode.go +++ b/pkg/detectors/geocode/geocode.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geocodify/geocodify.go b/pkg/detectors/geocodify/geocodify.go index 4cdd71af788d..d7347ffda90f 100644 --- a/pkg/detectors/geocodify/geocodify.go +++ b/pkg/detectors/geocodify/geocodify.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geocodio/geocodio.go b/pkg/detectors/geocodio/geocodio.go index 578997e22929..1776599b6b9b 100644 --- a/pkg/detectors/geocodio/geocodio.go +++ b/pkg/detectors/geocodio/geocodio.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result searchMatches := searchPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, searchMatch := range searchMatches { - if len(searchMatch) != 2 { - continue - } resSearchMatch := strings.TrimSpace(searchMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/geoipifi/geoipifi.go b/pkg/detectors/geoipifi/geoipifi.go index 868ea260c335..c26a638e0387 100644 --- a/pkg/detectors/geoipifi/geoipifi.go +++ b/pkg/detectors/geoipifi/geoipifi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getemail/getemail.go b/pkg/detectors/getemail/getemail.go index 3f0b224990b9..7631511172e1 100644 --- a/pkg/detectors/getemail/getemail.go +++ b/pkg/detectors/getemail/getemail.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getemails/getemails.go b/pkg/detectors/getemails/getemails.go index 24d53a2cf973..e55e5ce6eb06 100644 --- a/pkg/detectors/getemails/getemails.go +++ b/pkg/detectors/getemails/getemails.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) diff --git a/pkg/detectors/getgeoapi/getgeoapi.go b/pkg/detectors/getgeoapi/getgeoapi.go index c3cd69ebf877..906e07debd35 100644 --- a/pkg/detectors/getgeoapi/getgeoapi.go +++ b/pkg/detectors/getgeoapi/getgeoapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getgist/getgist.go b/pkg/detectors/getgist/getgist.go index 77daa21df3d3..441e5290d00f 100644 --- a/pkg/detectors/getgist/getgist.go +++ b/pkg/detectors/getgist/getgist.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getresponse/getresponse.go b/pkg/detectors/getresponse/getresponse.go index ee0573a442c0..b11d6b7dee4a 100644 --- a/pkg/detectors/getresponse/getresponse.go +++ b/pkg/detectors/getresponse/getresponse.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/getsandbox/getsandbox.go b/pkg/detectors/getsandbox/getsandbox.go index d8a13446e538..0e22282b11d6 100644 --- a/pkg/detectors/getsandbox/getsandbox.go +++ b/pkg/detectors/getsandbox/getsandbox.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/github/v1/github_old.go b/pkg/detectors/github/v1/github_old.go index 3340311870aa..d5ed02997c75 100644 --- a/pkg/detectors/github/v1/github_old.go +++ b/pkg/detectors/github/v1/github_old.go @@ -65,9 +65,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, match := range matches { // First match is entire regex, second is the first group. - if len(match) != 2 { - continue - } token := match[1] diff --git a/pkg/detectors/github/v2/github.go b/pkg/detectors/github/v2/github.go index 2c21a3ce4129..9ee3f4174363 100644 --- a/pkg/detectors/github/v2/github.go +++ b/pkg/detectors/github/v2/github.go @@ -53,9 +53,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, match := range matches { // First match is entire regex, second is the first group. - if len(match) != 2 { - continue - } token := match[1] diff --git a/pkg/detectors/github_oauth2/github_oauth2.go b/pkg/detectors/github_oauth2/github_oauth2.go index 7a21053db95d..4f2109c95c82 100644 --- a/pkg/detectors/github_oauth2/github_oauth2.go +++ b/pkg/detectors/github_oauth2/github_oauth2.go @@ -41,13 +41,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result oauth2ClientSecretMatches := oauth2ClientSecretPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range oauth2ClientIDMatches { - if len(idMatch) != 2 { - continue - } for _, secretMatch := range oauth2ClientSecretMatches { - if len(secretMatch) != 2 { - continue - } s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_GitHubOauth2, diff --git a/pkg/detectors/githubapp/githubapp.go b/pkg/detectors/githubapp/githubapp.go index 8eb48d69f0ee..84e8a800de01 100644 --- a/pkg/detectors/githubapp/githubapp.go +++ b/pkg/detectors/githubapp/githubapp.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result appMatches := appPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, appMatch := range appMatches { - if len(appMatch) != 2 { - continue - } appResMatch := strings.TrimSpace(appMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_GitHubApp, diff --git a/pkg/detectors/gitlab/v1/gitlab.go b/pkg/detectors/gitlab/v1/gitlab.go index c718366222a0..93befbf7794f 100644 --- a/pkg/detectors/gitlab/v1/gitlab.go +++ b/pkg/detectors/gitlab/v1/gitlab.go @@ -47,9 +47,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } // ignore v2 detectors which have a prefix of `glpat-` if strings.Contains(match[0], "glpat-") { continue diff --git a/pkg/detectors/gitlab/v2/gitlab_v2.go b/pkg/detectors/gitlab/v2/gitlab_v2.go index d0d413c60ea5..068e52ec705b 100644 --- a/pkg/detectors/gitlab/v2/gitlab_v2.go +++ b/pkg/detectors/gitlab/v2/gitlab_v2.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gitter/gitter.go b/pkg/detectors/gitter/gitter.go index a0924bf2c108..716346f06d80 100644 --- a/pkg/detectors/gitter/gitter.go +++ b/pkg/detectors/gitter/gitter.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/glassnode/glassnode.go b/pkg/detectors/glassnode/glassnode.go index e20516c4d445..af45eae00e39 100644 --- a/pkg/detectors/glassnode/glassnode.go +++ b/pkg/detectors/glassnode/glassnode.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gocanvas/gocanvas.go b/pkg/detectors/gocanvas/gocanvas.go index 95cd31cb20ad..559ab569f0c2 100644 --- a/pkg/detectors/gocanvas/gocanvas.go +++ b/pkg/detectors/gocanvas/gocanvas.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gocardless/gocardless.go b/pkg/detectors/gocardless/gocardless.go index 3b139a20cac0..bc2db419f179 100644 --- a/pkg/detectors/gocardless/gocardless.go +++ b/pkg/detectors/gocardless/gocardless.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/goodday/goodday.go b/pkg/detectors/goodday/goodday.go index e51f91fafbe3..965b32aefd58 100644 --- a/pkg/detectors/goodday/goodday.go +++ b/pkg/detectors/goodday/goodday.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/grafana/grafana.go b/pkg/detectors/grafana/grafana.go index 182453af0d09..f241ce0521da 100644 --- a/pkg/detectors/grafana/grafana.go +++ b/pkg/detectors/grafana/grafana.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go b/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go index b450582ac71e..4fc1029a4529 100644 --- a/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go +++ b/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go @@ -3,10 +3,11 @@ package grafanaserviceaccount import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -40,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range keyMatches { - if len(match) != 2 { - continue - } key := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/graphcms/graphcms.go b/pkg/detectors/graphcms/graphcms.go index 46fcae8c46cd..c96562ca9a64 100644 --- a/pkg/detectors/graphcms/graphcms.go +++ b/pkg/detectors/graphcms/graphcms.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) diff --git a/pkg/detectors/graphhopper/graphhopper.go b/pkg/detectors/graphhopper/graphhopper.go index 363891894abc..8f97138e02ec 100644 --- a/pkg/detectors/graphhopper/graphhopper.go +++ b/pkg/detectors/graphhopper/graphhopper.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Graphhopper, diff --git a/pkg/detectors/groovehq/groovehq.go b/pkg/detectors/groovehq/groovehq.go index 0dee1c3d60c6..9018be0789a1 100644 --- a/pkg/detectors/groovehq/groovehq.go +++ b/pkg/detectors/groovehq/groovehq.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gtmetrix/gtmetrix.go b/pkg/detectors/gtmetrix/gtmetrix.go index 96ce3d2827da..d9baba1f42b8 100644 --- a/pkg/detectors/gtmetrix/gtmetrix.go +++ b/pkg/detectors/gtmetrix/gtmetrix.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/guardianapi/guardianapi.go b/pkg/detectors/guardianapi/guardianapi.go index 9da39d446dd6..899052d7f65d 100644 --- a/pkg/detectors/guardianapi/guardianapi.go +++ b/pkg/detectors/guardianapi/guardianapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/gumroad/gumroad.go b/pkg/detectors/gumroad/gumroad.go index 243f3204d061..44526c313950 100644 --- a/pkg/detectors/gumroad/gumroad.go +++ b/pkg/detectors/gumroad/gumroad.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/guru/guru.go b/pkg/detectors/guru/guru.go index 3156378525ba..d7a2a865fda9 100644 --- a/pkg/detectors/guru/guru.go +++ b/pkg/detectors/guru/guru.go @@ -40,16 +40,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range unameMatches { - if len(match) != 2 { - continue - } unameMatch := strings.TrimSpace(match[1]) for _, secret := range keyMatches { - if len(secret) != 2 { - continue - } keyMatch := strings.TrimSpace(secret[1]) diff --git a/pkg/detectors/gyazo/gyazo.go b/pkg/detectors/gyazo/gyazo.go index a058d7b37ba1..b25ef3939ff2 100644 --- a/pkg/detectors/gyazo/gyazo.go +++ b/pkg/detectors/gyazo/gyazo.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/happyscribe/happyscribe.go b/pkg/detectors/happyscribe/happyscribe.go index a5b49b1b236b..3ac52c2d643f 100644 --- a/pkg/detectors/happyscribe/happyscribe.go +++ b/pkg/detectors/happyscribe/happyscribe.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/harvest/harvest.go b/pkg/detectors/harvest/harvest.go index 6f917485a38b..b4ba40e815a2 100644 --- a/pkg/detectors/harvest/harvest.go +++ b/pkg/detectors/harvest/harvest.go @@ -38,14 +38,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/hellosign/hellosign.go b/pkg/detectors/hellosign/hellosign.go index 24b6548dfe21..26413818dd70 100644 --- a/pkg/detectors/hellosign/hellosign.go +++ b/pkg/detectors/hellosign/hellosign.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/helpcrunch/helpcrunch.go b/pkg/detectors/helpcrunch/helpcrunch.go index d8396c788217..051accc938b6 100644 --- a/pkg/detectors/helpcrunch/helpcrunch.go +++ b/pkg/detectors/helpcrunch/helpcrunch.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/helpscout/helpscout.go b/pkg/detectors/helpscout/helpscout.go index 842a6dece5b7..11c04ca4c605 100644 --- a/pkg/detectors/helpscout/helpscout.go +++ b/pkg/detectors/helpscout/helpscout.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hereapi/hereapi.go b/pkg/detectors/hereapi/hereapi.go index bfb5e48119e1..ff4256549092 100644 --- a/pkg/detectors/hereapi/hereapi.go +++ b/pkg/detectors/hereapi/hereapi.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/heroku/heroku.go b/pkg/detectors/heroku/heroku.go index e6ce180e4167..e4beb71e4137 100644 --- a/pkg/detectors/heroku/heroku.go +++ b/pkg/detectors/heroku/heroku.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hive/hive.go b/pkg/detectors/hive/hive.go index c12bf141658f..cc115bc7c1e6 100644 --- a/pkg/detectors/hive/hive.go +++ b/pkg/detectors/hive/hive.go @@ -38,16 +38,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } idMatch := strings.TrimSpace(match[1]) for _, match := range keyMatches { - if len(match) != 2 { - continue - } keyMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hiveage/hiveage.go b/pkg/detectors/hiveage/hiveage.go index c797cbe30a18..c5d25ca90a2e 100644 --- a/pkg/detectors/hiveage/hiveage.go +++ b/pkg/detectors/hiveage/hiveage.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/holidayapi/holidayapi.go b/pkg/detectors/holidayapi/holidayapi.go index 1e24be439d54..44ad94afd2c8 100644 --- a/pkg/detectors/holidayapi/holidayapi.go +++ b/pkg/detectors/holidayapi/holidayapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/holistic/holistic.go b/pkg/detectors/holistic/holistic.go index 42fb87a5df74..7f67791a2ee7 100644 --- a/pkg/detectors/holistic/holistic.go +++ b/pkg/detectors/holistic/holistic.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/honeycomb/honeycomb.go b/pkg/detectors/honeycomb/honeycomb.go index c52beae7b4e6..b0140ddc8f69 100644 --- a/pkg/detectors/honeycomb/honeycomb.go +++ b/pkg/detectors/honeycomb/honeycomb.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/host/host.go b/pkg/detectors/host/host.go index 416bb457fc45..9d5f00390b3e 100644 --- a/pkg/detectors/host/host.go +++ b/pkg/detectors/host/host.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/html2pdf/html2pdf.go b/pkg/detectors/html2pdf/html2pdf.go index 20f8328bdd6f..07298a539402 100644 --- a/pkg/detectors/html2pdf/html2pdf.go +++ b/pkg/detectors/html2pdf/html2pdf.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hubspotapikey/hubspotapikey.go b/pkg/detectors/hubspotapikey/hubspotapikey.go index e912dea44096..fd785cd1f80c 100644 --- a/pkg/detectors/hubspotapikey/hubspotapikey.go +++ b/pkg/detectors/hubspotapikey/hubspotapikey.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/huggingface/huggingface.go b/pkg/detectors/huggingface/huggingface.go index f836def20f92..a38018087234 100644 --- a/pkg/detectors/huggingface/huggingface.go +++ b/pkg/detectors/huggingface/huggingface.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 1 { - continue - } resMatch := strings.TrimSpace(match[0]) s1 := detectors.Result{ diff --git a/pkg/detectors/humanity/humanity.go b/pkg/detectors/humanity/humanity.go index 57e987d95673..13170bd00f3a 100644 --- a/pkg/detectors/humanity/humanity.go +++ b/pkg/detectors/humanity/humanity.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hunter/hunter.go b/pkg/detectors/hunter/hunter.go index 2c2949ab4337..a480dfced386 100644 --- a/pkg/detectors/hunter/hunter.go +++ b/pkg/detectors/hunter/hunter.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hybiscus/hybiscus.go b/pkg/detectors/hybiscus/hybiscus.go index 1ccbade48b05..b741febb1374 100644 --- a/pkg/detectors/hybiscus/hybiscus.go +++ b/pkg/detectors/hybiscus/hybiscus.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/hypertrack/hypertrack.go b/pkg/detectors/hypertrack/hypertrack.go index 6a257e546854..7edc17055ddf 100644 --- a/pkg/detectors/hypertrack/hypertrack.go +++ b/pkg/detectors/hypertrack/hypertrack.go @@ -38,16 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, accMatch := range accMatches { - - if len(accMatch) != 2 { - continue - } resAccMatch := strings.TrimSpace(accMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go b/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go index af8c57166952..fc2524a195bd 100644 --- a/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go +++ b/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go @@ -2,10 +2,11 @@ package ibmclouduserkey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/iconfinder/iconfinder.go b/pkg/detectors/iconfinder/iconfinder.go index 08aef96f21c7..785f394f3d2d 100644 --- a/pkg/detectors/iconfinder/iconfinder.go +++ b/pkg/detectors/iconfinder/iconfinder.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/iexapis/iexapis.go b/pkg/detectors/iexapis/iexapis.go index d4735f0d670e..8159321dccea 100644 --- a/pkg/detectors/iexapis/iexapis.go +++ b/pkg/detectors/iexapis/iexapis.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/iexcloud/iexcloud.go b/pkg/detectors/iexcloud/iexcloud.go index 57ed64208c55..7a19d752fc85 100644 --- a/pkg/detectors/iexcloud/iexcloud.go +++ b/pkg/detectors/iexcloud/iexcloud.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/imagekit/imagekit.go b/pkg/detectors/imagekit/imagekit.go index 549291a17d3f..76492efee101 100644 --- a/pkg/detectors/imagekit/imagekit.go +++ b/pkg/detectors/imagekit/imagekit.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/imagga/imagga.go b/pkg/detectors/imagga/imagga.go index 4c7130c65bb8..79ad0c9e930f 100644 --- a/pkg/detectors/imagga/imagga.go +++ b/pkg/detectors/imagga/imagga.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/impala/impala.go b/pkg/detectors/impala/impala.go index 0705954d6832..cd226650eaed 100644 --- a/pkg/detectors/impala/impala.go +++ b/pkg/detectors/impala/impala.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/infura/infura.go b/pkg/detectors/infura/infura.go index 653c5135182a..6fc62413394b 100644 --- a/pkg/detectors/infura/infura.go +++ b/pkg/detectors/infura/infura.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/insightly/insightly.go b/pkg/detectors/insightly/insightly.go index 1f298d8475c1..2fc08523536e 100644 --- a/pkg/detectors/insightly/insightly.go +++ b/pkg/detectors/insightly/insightly.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/instabot/instabot.go b/pkg/detectors/instabot/instabot.go index 24b5b3b92bce..397c1d474ddd 100644 --- a/pkg/detectors/instabot/instabot.go +++ b/pkg/detectors/instabot/instabot.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/instamojo/instamojo.go b/pkg/detectors/instamojo/instamojo.go index 249405f42afc..445b679ef76a 100644 --- a/pkg/detectors/instamojo/instamojo.go +++ b/pkg/detectors/instamojo/instamojo.go @@ -43,15 +43,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result clientIdmatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range secretMatches { - if len(match) != 2 { - continue - } resSecret := strings.TrimSpace(match[1]) for _, clientIdMatch := range clientIdmatches { - if len(clientIdMatch) != 2 { - continue - } resClientId := strings.TrimSpace(clientIdMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/intercom/intercom.go b/pkg/detectors/intercom/intercom.go index ad820bf7c291..2dd911027a22 100644 --- a/pkg/detectors/intercom/intercom.go +++ b/pkg/detectors/intercom/intercom.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) dec, err := base64.StdEncoding.DecodeString(resMatch) diff --git a/pkg/detectors/interseller/interseller.go b/pkg/detectors/interseller/interseller.go index fe96b67dbeab..908d6077e6a1 100644 --- a/pkg/detectors/interseller/interseller.go +++ b/pkg/detectors/interseller/interseller.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/intrinio/intrinio.go b/pkg/detectors/intrinio/intrinio.go index fb6a33bfcdbf..d600af0ae113 100644 --- a/pkg/detectors/intrinio/intrinio.go +++ b/pkg/detectors/intrinio/intrinio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/invoiceocean/invoiceocean.go b/pkg/detectors/invoiceocean/invoiceocean.go index 0669142ff1e2..43e6e17d8fe9 100644 --- a/pkg/detectors/invoiceocean/invoiceocean.go +++ b/pkg/detectors/invoiceocean/invoiceocean.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ip2location/ip2location.go b/pkg/detectors/ip2location/ip2location.go index 6dd8ed714ea5..180ea9bd1566 100644 --- a/pkg/detectors/ip2location/ip2location.go +++ b/pkg/detectors/ip2location/ip2location.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipapi/ipapi.go b/pkg/detectors/ipapi/ipapi.go index 7c00fcb2fd8f..5549b4be744e 100644 --- a/pkg/detectors/ipapi/ipapi.go +++ b/pkg/detectors/ipapi/ipapi.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipgeolocation/ipgeolocation.go b/pkg/detectors/ipgeolocation/ipgeolocation.go index c70162f79549..fbbabcd53dce 100644 --- a/pkg/detectors/ipgeolocation/ipgeolocation.go +++ b/pkg/detectors/ipgeolocation/ipgeolocation.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipinfo/ipinfo.go b/pkg/detectors/ipinfo/ipinfo.go index f36abaae34df..65c47f4a1b79 100644 --- a/pkg/detectors/ipinfo/ipinfo.go +++ b/pkg/detectors/ipinfo/ipinfo.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipinfodb/ipinfodb.go b/pkg/detectors/ipinfodb/ipinfodb.go index 5773f8279ca1..83ad22fb2143 100644 --- a/pkg/detectors/ipinfodb/ipinfodb.go +++ b/pkg/detectors/ipinfodb/ipinfodb.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipquality/ipquality.go b/pkg/detectors/ipquality/ipquality.go index dfa4b1a2180a..453937e250e6 100644 --- a/pkg/detectors/ipquality/ipquality.go +++ b/pkg/detectors/ipquality/ipquality.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ipstack/ipstack.go b/pkg/detectors/ipstack/ipstack.go index b09a0ab8d924..b1f43ee6a4c6 100644 --- a/pkg/detectors/ipstack/ipstack.go +++ b/pkg/detectors/ipstack/ipstack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_IpStack, diff --git a/pkg/detectors/jiratoken/v1/jiratoken.go b/pkg/detectors/jiratoken/v1/jiratoken.go index 92e243f34fb8..a5169bae84af 100644 --- a/pkg/detectors/jiratoken/v1/jiratoken.go +++ b/pkg/detectors/jiratoken/v1/jiratoken.go @@ -54,19 +54,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, email := range emails { email = strings.Split(email[0], " ") - if len(email) != 2 { - continue - } resEmail := strings.TrimSpace(email[1]) for _, token := range tokens { - if len(token) != 2 { - continue - } resToken := strings.TrimSpace(token[1]) for _, domain := range domains { - if len(domain) != 2 { - continue - } resDomain := strings.TrimSpace(domain[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/jiratoken/v2/jiratoken_v2.go b/pkg/detectors/jiratoken/v2/jiratoken_v2.go index c356c16a7866..45b46c1e87ff 100644 --- a/pkg/detectors/jiratoken/v2/jiratoken_v2.go +++ b/pkg/detectors/jiratoken/v2/jiratoken_v2.go @@ -60,14 +60,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } resEmail := strings.TrimSpace(email[1]) for _, token := range tokens { - if len(token) != 2 { - continue - } resToken := strings.TrimSpace(token[1]) for _, domain := range domains { - if len(domain) != 2 { - continue - } resDomain := strings.TrimSpace(domain[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/jotform/jotform.go b/pkg/detectors/jotform/jotform.go index d8005be54be4..13a289124563 100644 --- a/pkg/detectors/jotform/jotform.go +++ b/pkg/detectors/jotform/jotform.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/jumpcloud/jumpcloud.go b/pkg/detectors/jumpcloud/jumpcloud.go index cbd5b0ef2105..d1772bf5d157 100644 --- a/pkg/detectors/jumpcloud/jumpcloud.go +++ b/pkg/detectors/jumpcloud/jumpcloud.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Jumpcloud, diff --git a/pkg/detectors/jupiterone/jupiterone.go b/pkg/detectors/jupiterone/jupiterone.go index 2bf322bb15be..6f0528c6463a 100644 --- a/pkg/detectors/jupiterone/jupiterone.go +++ b/pkg/detectors/jupiterone/jupiterone.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/juro/juro.go b/pkg/detectors/juro/juro.go index c35dac3e4d1c..2683200416fd 100644 --- a/pkg/detectors/juro/juro.go +++ b/pkg/detectors/juro/juro.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kanban/kanban.go b/pkg/detectors/kanban/kanban.go index dabd5561ebba..ea5eec2270a2 100644 --- a/pkg/detectors/kanban/kanban.go +++ b/pkg/detectors/kanban/kanban.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kanbantool/kanbantool.go b/pkg/detectors/kanbantool/kanbantool.go index b2a32f579a6d..8a102099e955 100644 --- a/pkg/detectors/kanbantool/kanbantool.go +++ b/pkg/detectors/kanbantool/kanbantool.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) idMatches := domainPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/karmacrm/karmacrm.go b/pkg/detectors/karmacrm/karmacrm.go index 0fb783f27643..3f89ad0d2790 100644 --- a/pkg/detectors/karmacrm/karmacrm.go +++ b/pkg/detectors/karmacrm/karmacrm.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/keenio/keenio.go b/pkg/detectors/keenio/keenio.go index 0ff37ba09e92..a4b0531efcc2 100644 --- a/pkg/detectors/keenio/keenio.go +++ b/pkg/detectors/keenio/keenio.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/kickbox/kickbox.go b/pkg/detectors/kickbox/kickbox.go index a2c3df79b5a2..194dcb77ac28 100644 --- a/pkg/detectors/kickbox/kickbox.go +++ b/pkg/detectors/kickbox/kickbox.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/klaviyo/klaviyo.go b/pkg/detectors/klaviyo/klaviyo.go index 40495604226e..0133e55cb49e 100644 --- a/pkg/detectors/klaviyo/klaviyo.go +++ b/pkg/detectors/klaviyo/klaviyo.go @@ -52,9 +52,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/klipfolio/klipfolio.go b/pkg/detectors/klipfolio/klipfolio.go index b6d1078d222b..dbba62e21fe8 100644 --- a/pkg/detectors/klipfolio/klipfolio.go +++ b/pkg/detectors/klipfolio/klipfolio.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/knapsackpro/knapsackpro.go b/pkg/detectors/knapsackpro/knapsackpro.go index fa37e0ba540e..058b76b7fe4f 100644 --- a/pkg/detectors/knapsackpro/knapsackpro.go +++ b/pkg/detectors/knapsackpro/knapsackpro.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kontent/kontent.go b/pkg/detectors/kontent/kontent.go index af97f7ed94b9..00b92b208867 100644 --- a/pkg/detectors/kontent/kontent.go +++ b/pkg/detectors/kontent/kontent.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kraken/kraken.go b/pkg/detectors/kraken/kraken.go index b9cdf814b69e..85780e894874 100644 --- a/pkg/detectors/kraken/kraken.go +++ b/pkg/detectors/kraken/kraken.go @@ -47,15 +47,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result privKeyMatches := privKeyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, privKeyMatch := range privKeyMatches { - if len(privKeyMatch) != 2 { - continue - } resPrivKeyMatch := strings.TrimSpace(privKeyMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kucoin/kucoin.go b/pkg/detectors/kucoin/kucoin.go index 3ca40e1b1fb3..a9efe42ffcf7 100644 --- a/pkg/detectors/kucoin/kucoin.go +++ b/pkg/detectors/kucoin/kucoin.go @@ -45,21 +45,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passphraseMatches := passphrasePat.FindAllStringSubmatch(dataStr, -1) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKeyMatch := strings.TrimSpace(keyMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) for _, passphraseMatch := range passphraseMatches { - if len(passphraseMatch) != 2 { - continue - } resPassphraseMatch := strings.TrimSpace(passphraseMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/kylas/kylas.go b/pkg/detectors/kylas/kylas.go index c81235da6462..bab28495697b 100644 --- a/pkg/detectors/kylas/kylas.go +++ b/pkg/detectors/kylas/kylas.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/languagelayer/languagelayer.go b/pkg/detectors/languagelayer/languagelayer.go index 5f3c856b52bc..1ccbc29c47be 100644 --- a/pkg/detectors/languagelayer/languagelayer.go +++ b/pkg/detectors/languagelayer/languagelayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/launchdarkly/launchdarkly.go b/pkg/detectors/launchdarkly/launchdarkly.go index 10f1a1a0c685..f539e9e6a686 100644 --- a/pkg/detectors/launchdarkly/launchdarkly.go +++ b/pkg/detectors/launchdarkly/launchdarkly.go @@ -51,9 +51,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/leadfeeder/leadfeeder.go b/pkg/detectors/leadfeeder/leadfeeder.go index 44ca3feb3bcb..a1eef71a4ac6 100644 --- a/pkg/detectors/leadfeeder/leadfeeder.go +++ b/pkg/detectors/leadfeeder/leadfeeder.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lemlist/lemlist.go b/pkg/detectors/lemlist/lemlist.go index af21db0b9f90..3f7af7e20641 100644 --- a/pkg/detectors/lemlist/lemlist.go +++ b/pkg/detectors/lemlist/lemlist.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lemonsqueezy/lemonsqueezy.go b/pkg/detectors/lemonsqueezy/lemonsqueezy.go index 498af18dc375..daf22cd7feaa 100644 --- a/pkg/detectors/lemonsqueezy/lemonsqueezy.go +++ b/pkg/detectors/lemonsqueezy/lemonsqueezy.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lendflow/lendflow.go b/pkg/detectors/lendflow/lendflow.go index c8777cc8552e..ec8ef5cb9945 100644 --- a/pkg/detectors/lendflow/lendflow.go +++ b/pkg/detectors/lendflow/lendflow.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go b/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go index 4c475bcb55e6..f78d485aa4ea 100644 --- a/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go +++ b/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go @@ -3,10 +3,11 @@ package lessannoyingcrm import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lexigram/lexigram.go b/pkg/detectors/lexigram/lexigram.go index 4af5b9b6bc67..61c91596586f 100644 --- a/pkg/detectors/lexigram/lexigram.go +++ b/pkg/detectors/lexigram/lexigram.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/linearapi/linearapi.go b/pkg/detectors/linearapi/linearapi.go index d17194cc72a9..748b0167eb12 100644 --- a/pkg/detectors/linearapi/linearapi.go +++ b/pkg/detectors/linearapi/linearapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/linemessaging/linemessaging.go b/pkg/detectors/linemessaging/linemessaging.go index c5405c06a8f7..00a515b96cd5 100644 --- a/pkg/detectors/linemessaging/linemessaging.go +++ b/pkg/detectors/linemessaging/linemessaging.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/linenotify/linenotify.go b/pkg/detectors/linenotify/linenotify.go index 2fd52104c262..d14614894cfb 100644 --- a/pkg/detectors/linenotify/linenotify.go +++ b/pkg/detectors/linenotify/linenotify.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/linkpreview/linkpreview.go b/pkg/detectors/linkpreview/linkpreview.go index 75cd7891c59e..eda10b4c20c8 100644 --- a/pkg/detectors/linkpreview/linkpreview.go +++ b/pkg/detectors/linkpreview/linkpreview.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/liveagent/liveagent.go b/pkg/detectors/liveagent/liveagent.go index 314845c6bd77..17da1a70c9a7 100644 --- a/pkg/detectors/liveagent/liveagent.go +++ b/pkg/detectors/liveagent/liveagent.go @@ -43,16 +43,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[0]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_LiveAgent, diff --git a/pkg/detectors/livestorm/livestorm.go b/pkg/detectors/livestorm/livestorm.go index 92e6afcdc88b..036c1e0b9682 100644 --- a/pkg/detectors/livestorm/livestorm.go +++ b/pkg/detectors/livestorm/livestorm.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/loadmill/loadmill.go b/pkg/detectors/loadmill/loadmill.go index b2a5dbb65ed4..8afaa1e2be1d 100644 --- a/pkg/detectors/loadmill/loadmill.go +++ b/pkg/detectors/loadmill/loadmill.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lob/lob.go b/pkg/detectors/lob/lob.go index 438fcc010ac5..7002a7138652 100644 --- a/pkg/detectors/lob/lob.go +++ b/pkg/detectors/lob/lob.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/locationiq/locationiq.go b/pkg/detectors/locationiq/locationiq.go index 5c96ecb73d5a..04e05b47fbf1 100644 --- a/pkg/detectors/locationiq/locationiq.go +++ b/pkg/detectors/locationiq/locationiq.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/loggly/loggly.go b/pkg/detectors/loggly/loggly.go index 9ed2c60cb3d8..871a4608d7fd 100644 --- a/pkg/detectors/loggly/loggly.go +++ b/pkg/detectors/loggly/loggly.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range keyMatches { - if len(match) != 2 { - continue - } key := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } domainRes := strings.TrimSpace(domainMatch[1]) diff --git a/pkg/detectors/loginradius/loginradius.go b/pkg/detectors/loginradius/loginradius.go index 0e26b57f06dc..484c05a04c56 100644 --- a/pkg/detectors/loginradius/loginradius.go +++ b/pkg/detectors/loginradius/loginradius.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/logzio/logzio.go b/pkg/detectors/logzio/logzio.go index 58b8f4f472c6..1c1d3353913e 100644 --- a/pkg/detectors/logzio/logzio.go +++ b/pkg/detectors/logzio/logzio.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lokalisetoken/lokalisetoken.go b/pkg/detectors/lokalisetoken/lokalisetoken.go index 213890bdbbb8..5c69a7d4b69c 100644 --- a/pkg/detectors/lokalisetoken/lokalisetoken.go +++ b/pkg/detectors/lokalisetoken/lokalisetoken.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/loyverse/loyverse.go b/pkg/detectors/loyverse/loyverse.go index 2ec5076959b1..d5e64604acd9 100644 --- a/pkg/detectors/loyverse/loyverse.go +++ b/pkg/detectors/loyverse/loyverse.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/lunchmoney/lunchmoney.go b/pkg/detectors/lunchmoney/lunchmoney.go index 44b4aa7ab254..a5c2231f6f07 100644 --- a/pkg/detectors/lunchmoney/lunchmoney.go +++ b/pkg/detectors/lunchmoney/lunchmoney.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/luno/luno.go b/pkg/detectors/luno/luno.go index af9798b3245c..c70cad6ee0ce 100644 --- a/pkg/detectors/luno/luno.go +++ b/pkg/detectors/luno/luno.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/m3o/m3o.go b/pkg/detectors/m3o/m3o.go index 2ec5ca4c4773..ac68a1792620 100644 --- a/pkg/detectors/m3o/m3o.go +++ b/pkg/detectors/m3o/m3o.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/madkudu/madkudu.go b/pkg/detectors/madkudu/madkudu.go index 398514891283..295617562846 100644 --- a/pkg/detectors/madkudu/madkudu.go +++ b/pkg/detectors/madkudu/madkudu.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/magicbell/magicbell.go b/pkg/detectors/magicbell/magicbell.go index 65332d0fcaa0..3ef267f20d31 100644 --- a/pkg/detectors/magicbell/magicbell.go +++ b/pkg/detectors/magicbell/magicbell.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, keyMatch := range apiKeyMatches { - if len(keyMatch) != 2 { - continue - } apiKeyRes := strings.TrimSpace(keyMatch[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } emailRes := strings.TrimSpace(emailMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/magnetic/magnetic.go b/pkg/detectors/magnetic/magnetic.go index d6b1f1ef7534..49d8d7d3cb79 100644 --- a/pkg/detectors/magnetic/magnetic.go +++ b/pkg/detectors/magnetic/magnetic.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailboxlayer/mailboxlayer.go b/pkg/detectors/mailboxlayer/mailboxlayer.go index dd4112b5b1cb..3eb0e77532b8 100644 --- a/pkg/detectors/mailboxlayer/mailboxlayer.go +++ b/pkg/detectors/mailboxlayer/mailboxlayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailerlite/mailerlite.go b/pkg/detectors/mailerlite/mailerlite.go index bf757bff5445..56b95f4c05f9 100644 --- a/pkg/detectors/mailerlite/mailerlite.go +++ b/pkg/detectors/mailerlite/mailerlite.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailgun/mailgun.go b/pkg/detectors/mailgun/mailgun.go index 991b7f2f0de2..3420f11d0f09 100644 --- a/pkg/detectors/mailgun/mailgun.go +++ b/pkg/detectors/mailgun/mailgun.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, tokenPat := range tokenPats { matches := tokenPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go b/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go index 6eca7efb06af..1f87e4d80daf 100644 --- a/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go +++ b/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go @@ -3,10 +3,11 @@ package mailjetbasicauth import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailjetsms/mailjetsms.go b/pkg/detectors/mailjetsms/mailjetsms.go index 0118f2ff607e..8845ae26311e 100644 --- a/pkg/detectors/mailjetsms/mailjetsms.go +++ b/pkg/detectors/mailjetsms/mailjetsms.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailmodo/mailmodo.go b/pkg/detectors/mailmodo/mailmodo.go index 0c8081ca0283..0697826cb4a8 100644 --- a/pkg/detectors/mailmodo/mailmodo.go +++ b/pkg/detectors/mailmodo/mailmodo.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mailsac/mailsac.go b/pkg/detectors/mailsac/mailsac.go index c758c173f2ca..efd32438d454 100644 --- a/pkg/detectors/mailsac/mailsac.go +++ b/pkg/detectors/mailsac/mailsac.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mandrill/mandrill.go b/pkg/detectors/mandrill/mandrill.go index df33889be648..b872ffcc8df8 100644 --- a/pkg/detectors/mandrill/mandrill.go +++ b/pkg/detectors/mandrill/mandrill.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/manifest/manifest.go b/pkg/detectors/manifest/manifest.go index 6a11688a5af5..927319e5e2c2 100644 --- a/pkg/detectors/manifest/manifest.go +++ b/pkg/detectors/manifest/manifest.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mapbox/mapbox.go b/pkg/detectors/mapbox/mapbox.go index a1341c4e15fe..dd15f32acae1 100644 --- a/pkg/detectors/mapbox/mapbox.go +++ b/pkg/detectors/mapbox/mapbox.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resMatch := strings.TrimSpace(match[1]) for i, idMatch := range idMatches { if i == 11 { - if len(idMatch) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mapquest/mapquest.go b/pkg/detectors/mapquest/mapquest.go index 78807166f4c2..8b8c4dbad46a 100644 --- a/pkg/detectors/mapquest/mapquest.go +++ b/pkg/detectors/mapquest/mapquest.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/marketstack/marketstack.go b/pkg/detectors/marketstack/marketstack.go index 903f750bfdb8..e7a4ae2fdd6c 100644 --- a/pkg/detectors/marketstack/marketstack.go +++ b/pkg/detectors/marketstack/marketstack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go index 80c6627cfecf..39de856e88ea 100644 --- a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go +++ b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go @@ -3,10 +3,11 @@ package mattermostpersonaltoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result serverMatches := serverPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, serverMatch := range serverMatches { - if len(serverMatch) != 2 { - continue - } serverRes := strings.TrimSpace(serverMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mavenlink/mavenlink.go b/pkg/detectors/mavenlink/mavenlink.go index b6f6296f2caf..cbae29d0a682 100644 --- a/pkg/detectors/mavenlink/mavenlink.go +++ b/pkg/detectors/mavenlink/mavenlink.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/maxmindlicense/v1/maxmindlicense.go b/pkg/detectors/maxmindlicense/v1/maxmindlicense.go index 6a2ac4119655..6c61e7a2ad58 100644 --- a/pkg/detectors/maxmindlicense/v1/maxmindlicense.go +++ b/pkg/detectors/maxmindlicense/v1/maxmindlicense.go @@ -44,9 +44,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyRes := strings.TrimSpace(keyMatch[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } idRes := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/meaningcloud/meaningcloud.go b/pkg/detectors/meaningcloud/meaningcloud.go index 50ce02f65b38..0089aa48a2a3 100644 --- a/pkg/detectors/meaningcloud/meaningcloud.go +++ b/pkg/detectors/meaningcloud/meaningcloud.go @@ -44,9 +44,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mediastack/mediastack.go b/pkg/detectors/mediastack/mediastack.go index d8116e0e4b2e..c4846782eb98 100644 --- a/pkg/detectors/mediastack/mediastack.go +++ b/pkg/detectors/mediastack/mediastack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/meistertask/meistertask.go b/pkg/detectors/meistertask/meistertask.go index 205ac3b03ed2..12f0d73f5495 100644 --- a/pkg/detectors/meistertask/meistertask.go +++ b/pkg/detectors/meistertask/meistertask.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mesibo/mesibo.go b/pkg/detectors/mesibo/mesibo.go index e2daed88492a..84daf381ca1a 100644 --- a/pkg/detectors/mesibo/mesibo.go +++ b/pkg/detectors/mesibo/mesibo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/messagebird/messagebird.go b/pkg/detectors/messagebird/messagebird.go index 5bc2f84857ef..88d9c2dd5676 100644 --- a/pkg/detectors/messagebird/messagebird.go +++ b/pkg/detectors/messagebird/messagebird.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/metaapi/metaapi.go b/pkg/detectors/metaapi/metaapi.go index 4a89aef1c468..656a67bbe659 100644 --- a/pkg/detectors/metaapi/metaapi.go +++ b/pkg/detectors/metaapi/metaapi.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result spellMatches := spellPat.FindAllStringSubmatch(dataStr, -1) for _, spellMatch := range spellMatches { - if len(spellMatch) != 2 { - continue - } resSpellMatch := strings.TrimSpace(spellMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/metabase/metabase.go b/pkg/detectors/metabase/metabase.go index 852e671fcd59..5ce348f5e71b 100644 --- a/pkg/detectors/metabase/metabase.go +++ b/pkg/detectors/metabase/metabase.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := baseURL.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURLMatch := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/metrilo/metrilo.go b/pkg/detectors/metrilo/metrilo.go index cee0e2bc47c9..90e3cc4f1e11 100644 --- a/pkg/detectors/metrilo/metrilo.go +++ b/pkg/detectors/metrilo/metrilo.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go b/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go index 7175f7fbcfec..eb1858ce5189 100644 --- a/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go +++ b/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go @@ -3,12 +3,13 @@ package microsoftteamswebhook import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" "time" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mindmeister/mindmeister.go b/pkg/detectors/mindmeister/mindmeister.go index f11ed882f5e7..7d98611ac637 100644 --- a/pkg/detectors/mindmeister/mindmeister.go +++ b/pkg/detectors/mindmeister/mindmeister.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/miro/miro.go b/pkg/detectors/miro/miro.go index 3e5bd2cfbc01..a6998b35861f 100644 --- a/pkg/detectors/miro/miro.go +++ b/pkg/detectors/miro/miro.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mite/mite.go b/pkg/detectors/mite/mite.go index 067d9a470143..9ea11946730f 100644 --- a/pkg/detectors/mite/mite.go +++ b/pkg/detectors/mite/mite.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mixmax/mixmax.go b/pkg/detectors/mixmax/mixmax.go index 9bc4d62283dd..843a3d837ddf 100644 --- a/pkg/detectors/mixmax/mixmax.go +++ b/pkg/detectors/mixmax/mixmax.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mixpanel/mixpanel.go b/pkg/detectors/mixpanel/mixpanel.go index 6e9110a3c606..3259b2fc0748 100644 --- a/pkg/detectors/mixpanel/mixpanel.go +++ b/pkg/detectors/mixpanel/mixpanel.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/mockaroo/mockaroo.go b/pkg/detectors/mockaroo/mockaroo.go index 0fe00c1b1765..509260f7c556 100644 --- a/pkg/detectors/mockaroo/mockaroo.go +++ b/pkg/detectors/mockaroo/mockaroo.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/moderation/moderation.go b/pkg/detectors/moderation/moderation.go index 49c23075695e..34c503d2aa93 100644 --- a/pkg/detectors/moderation/moderation.go +++ b/pkg/detectors/moderation/moderation.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/monday/monday.go b/pkg/detectors/monday/monday.go index e319fa763f61..6aef6acf5085 100644 --- a/pkg/detectors/monday/monday.go +++ b/pkg/detectors/monday/monday.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/monkeylearn/monkeylearn.go b/pkg/detectors/monkeylearn/monkeylearn.go index 773fc7f48217..4403046ccb28 100644 --- a/pkg/detectors/monkeylearn/monkeylearn.go +++ b/pkg/detectors/monkeylearn/monkeylearn.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/moonclerk/moonclerk.go b/pkg/detectors/moonclerk/moonclerk.go index 083f3bc2f127..33462379c8e3 100644 --- a/pkg/detectors/moonclerk/moonclerk.go +++ b/pkg/detectors/moonclerk/moonclerk.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/moosend/moosend.go b/pkg/detectors/moosend/moosend.go index cbbb7079499a..f9779632be25 100644 --- a/pkg/detectors/moosend/moosend.go +++ b/pkg/detectors/moosend/moosend.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/moralis/moralis.go b/pkg/detectors/moralis/moralis.go index 59a647ff7cb8..1ff2de16af2f 100644 --- a/pkg/detectors/moralis/moralis.go +++ b/pkg/detectors/moralis/moralis.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mrticktock/mrticktock.go b/pkg/detectors/mrticktock/mrticktock.go index c2fb5737f9d3..4ca3195c30a7 100644 --- a/pkg/detectors/mrticktock/mrticktock.go +++ b/pkg/detectors/mrticktock/mrticktock.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passwordMatches := pwordPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, passwordMatch := range passwordMatches { - if len(passwordMatch) != 2 { - continue - } resPassword := strings.TrimSpace(passwordMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/mux/mux.go b/pkg/detectors/mux/mux.go index ef2679da0b5a..127fe6b16a97 100644 --- a/pkg/detectors/mux/mux.go +++ b/pkg/detectors/mux/mux.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/myfreshworks/myfreshworks.go b/pkg/detectors/myfreshworks/myfreshworks.go index c29801306802..39581f9c2cd5 100644 --- a/pkg/detectors/myfreshworks/myfreshworks.go +++ b/pkg/detectors/myfreshworks/myfreshworks.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/myintervals/myintervals.go b/pkg/detectors/myintervals/myintervals.go index 2bac40d341ad..7860fbae4513 100644 --- a/pkg/detectors/myintervals/myintervals.go +++ b/pkg/detectors/myintervals/myintervals.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go b/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go index 877373e90348..bfcb8df2f483 100644 --- a/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go +++ b/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nethunt/nethunt.go b/pkg/detectors/nethunt/nethunt.go index 5e5ebdc04787..043a2cc1dafe 100644 --- a/pkg/detectors/nethunt/nethunt.go +++ b/pkg/detectors/nethunt/nethunt.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/netlify/netlify.go b/pkg/detectors/netlify/netlify.go index fdfde21aba98..f25a639b705b 100644 --- a/pkg/detectors/netlify/netlify.go +++ b/pkg/detectors/netlify/netlify.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/neutrinoapi/neutrinoapi.go b/pkg/detectors/neutrinoapi/neutrinoapi.go index d5bc2da97998..282a85a02df1 100644 --- a/pkg/detectors/neutrinoapi/neutrinoapi.go +++ b/pkg/detectors/neutrinoapi/neutrinoapi.go @@ -42,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) diff --git a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go index c5e7025451d8..1f48435d0b3e 100644 --- a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go +++ b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go @@ -2,10 +2,11 @@ package newrelicpersonalapikey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/newsapi/newsapi.go b/pkg/detectors/newsapi/newsapi.go index 1864376b7c23..36f4a13edb8c 100644 --- a/pkg/detectors/newsapi/newsapi.go +++ b/pkg/detectors/newsapi/newsapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/newscatcher/newscatcher.go b/pkg/detectors/newscatcher/newscatcher.go index ccddc5b9cf4f..c7252b8fa9db 100644 --- a/pkg/detectors/newscatcher/newscatcher.go +++ b/pkg/detectors/newscatcher/newscatcher.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nexmoapikey/nexmoapikey.go b/pkg/detectors/nexmoapikey/nexmoapikey.go index 19bdc4c9fb2c..916e9618f1ff 100644 --- a/pkg/detectors/nexmoapikey/nexmoapikey.go +++ b/pkg/detectors/nexmoapikey/nexmoapikey.go @@ -38,14 +38,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretPat := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretPat { - if len(match) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nftport/nftport.go b/pkg/detectors/nftport/nftport.go index 820392cd47fb..0396f81076ee 100644 --- a/pkg/detectors/nftport/nftport.go +++ b/pkg/detectors/nftport/nftport.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ngc/ngc.go b/pkg/detectors/ngc/ngc.go index 8f707cb5d883..385bcad1083c 100644 --- a/pkg/detectors/ngc/ngc.go +++ b/pkg/detectors/ngc/ngc.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat1.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) decode, _ := base64.StdEncoding.DecodeString(resMatch) diff --git a/pkg/detectors/ngrok/ngrok.go b/pkg/detectors/ngrok/ngrok.go index 752882daa418..68ea826e7d8c 100644 --- a/pkg/detectors/ngrok/ngrok.go +++ b/pkg/detectors/ngrok/ngrok.go @@ -34,9 +34,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nicereply/nicereply.go b/pkg/detectors/nicereply/nicereply.go index 12bb87cb7c69..6c37034f1fd7 100644 --- a/pkg/detectors/nicereply/nicereply.go +++ b/pkg/detectors/nicereply/nicereply.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nightfall/nightfall.go b/pkg/detectors/nightfall/nightfall.go index 3fc22196e1a3..f1b104a9a989 100644 --- a/pkg/detectors/nightfall/nightfall.go +++ b/pkg/detectors/nightfall/nightfall.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/nimble/nimble.go b/pkg/detectors/nimble/nimble.go index dab1a194acb7..4d1c4784a33e 100644 --- a/pkg/detectors/nimble/nimble.go +++ b/pkg/detectors/nimble/nimble.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/noticeable/noticeable.go b/pkg/detectors/noticeable/noticeable.go index 52aa4ab6bb66..68d4134b1e91 100644 --- a/pkg/detectors/noticeable/noticeable.go +++ b/pkg/detectors/noticeable/noticeable.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/notion/notion.go b/pkg/detectors/notion/notion.go index dea8a9ea231f..9d79bba9eef2 100644 --- a/pkg/detectors/notion/notion.go +++ b/pkg/detectors/notion/notion.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Notion, diff --git a/pkg/detectors/nozbeteams/nozbeteams.go b/pkg/detectors/nozbeteams/nozbeteams.go index 3282cdc9cc89..2afe1e9c5987 100644 --- a/pkg/detectors/nozbeteams/nozbeteams.go +++ b/pkg/detectors/nozbeteams/nozbeteams.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/npmtoken/npmtoken.go b/pkg/detectors/npmtoken/npmtoken.go index 73a0f9800ccc..87b5c78ef8bb 100644 --- a/pkg/detectors/npmtoken/npmtoken.go +++ b/pkg/detectors/npmtoken/npmtoken.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/npmtokenv2/npmtokenv2.go b/pkg/detectors/npmtokenv2/npmtokenv2.go index 15d54ba66606..84ea6c94457e 100644 --- a/pkg/detectors/npmtokenv2/npmtokenv2.go +++ b/pkg/detectors/npmtokenv2/npmtokenv2.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := match[1] s1 := detectors.Result{ diff --git a/pkg/detectors/nugetapikey/nugetapikey.go b/pkg/detectors/nugetapikey/nugetapikey.go index 4a7c6af99eab..63cd05f38d23 100644 --- a/pkg/detectors/nugetapikey/nugetapikey.go +++ b/pkg/detectors/nugetapikey/nugetapikey.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/numverify/numverify.go b/pkg/detectors/numverify/numverify.go index 420668491d1f..9ae299c78672 100644 --- a/pkg/detectors/numverify/numverify.go +++ b/pkg/detectors/numverify/numverify.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Numverify, diff --git a/pkg/detectors/nutritionix/nutritionix.go b/pkg/detectors/nutritionix/nutritionix.go index 8594761f1e00..e37312d2fccd 100644 --- a/pkg/detectors/nutritionix/nutritionix.go +++ b/pkg/detectors/nutritionix/nutritionix.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) diff --git a/pkg/detectors/nylas/nylas.go b/pkg/detectors/nylas/nylas.go index c05e53460488..7e0d59e7a79e 100644 --- a/pkg/detectors/nylas/nylas.go +++ b/pkg/detectors/nylas/nylas.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/oanda/oanda.go b/pkg/detectors/oanda/oanda.go index de31ae0c0e5d..ffab5baa761d 100644 --- a/pkg/detectors/oanda/oanda.go +++ b/pkg/detectors/oanda/oanda.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/omnisend/omnisend.go b/pkg/detectors/omnisend/omnisend.go index c058f07b74ac..73e90192bb16 100644 --- a/pkg/detectors/omnisend/omnisend.go +++ b/pkg/detectors/omnisend/omnisend.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/onedesk/onedesk.go b/pkg/detectors/onedesk/onedesk.go index 621e78f6936a..01ab85b4527b 100644 --- a/pkg/detectors/onedesk/onedesk.go +++ b/pkg/detectors/onedesk/onedesk.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result pwordMatches := pwordPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, pwordMatch := range pwordMatches { - if len(pwordMatch) != 2 { - continue - } resPword := strings.TrimSpace(pwordMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/onelogin/onelogin.go b/pkg/detectors/onelogin/onelogin.go index d77a674a27b7..3e22b58b7a8a 100644 --- a/pkg/detectors/onelogin/onelogin.go +++ b/pkg/detectors/onelogin/onelogin.go @@ -39,13 +39,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) for _, clientID := range oauthClientIDPat.FindAllStringSubmatch(dataStr, -1) { - if len(clientID) != 2 { - continue - } for _, clientSecret := range oauthClientSecretPat.FindAllStringSubmatch(dataStr, -1) { - if len(clientSecret) != 2 { - continue - } s := detectors.Result{ DetectorType: detectorspb.DetectorType_OneLogin, diff --git a/pkg/detectors/onepagecrm/onepagecrm.go b/pkg/detectors/onepagecrm/onepagecrm.go index d6e43e8c581c..ac85a4994d07 100644 --- a/pkg/detectors/onepagecrm/onepagecrm.go +++ b/pkg/detectors/onepagecrm/onepagecrm.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/onesignal/onesignal.go b/pkg/detectors/onesignal/onesignal.go index 1829a2188c10..057f09edf865 100644 --- a/pkg/detectors/onesignal/onesignal.go +++ b/pkg/detectors/onesignal/onesignal.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/onwaterio/onwaterio.go b/pkg/detectors/onwaterio/onwaterio.go index 725451a459f4..618f0a19dfea 100644 --- a/pkg/detectors/onwaterio/onwaterio.go +++ b/pkg/detectors/onwaterio/onwaterio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/oopspam/oopspam.go b/pkg/detectors/oopspam/oopspam.go index 0199c2b46d53..00385f248462 100644 --- a/pkg/detectors/oopspam/oopspam.go +++ b/pkg/detectors/oopspam/oopspam.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/openai/openai.go b/pkg/detectors/openai/openai.go index 5e4442786e13..950768431b98 100644 --- a/pkg/detectors/openai/openai.go +++ b/pkg/detectors/openai/openai.go @@ -51,9 +51,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, match := range matches { // First match is entire regex, second is the first group. - if len(match) != 2 { - continue - } token := match[1] diff --git a/pkg/detectors/opencagedata/opencagedata.go b/pkg/detectors/opencagedata/opencagedata.go index 9b21e81e8f74..10a44e986a0c 100644 --- a/pkg/detectors/opencagedata/opencagedata.go +++ b/pkg/detectors/opencagedata/opencagedata.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/openuv/openuv.go b/pkg/detectors/openuv/openuv.go index 1a9f4bb8f2aa..58f9f6d341fc 100644 --- a/pkg/detectors/openuv/openuv.go +++ b/pkg/detectors/openuv/openuv.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/openweather/openweather.go b/pkg/detectors/openweather/openweather.go index 747a373191a2..9702983985f1 100644 --- a/pkg/detectors/openweather/openweather.go +++ b/pkg/detectors/openweather/openweather.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/opsgenie/opsgenie.go b/pkg/detectors/opsgenie/opsgenie.go index 5f2938c13d94..f0b85293d8d5 100644 --- a/pkg/detectors/opsgenie/opsgenie.go +++ b/pkg/detectors/opsgenie/opsgenie.go @@ -43,9 +43,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/optimizely/optimizely.go b/pkg/detectors/optimizely/optimizely.go index f3a90e2b3a98..014b4e252dfa 100644 --- a/pkg/detectors/optimizely/optimizely.go +++ b/pkg/detectors/optimizely/optimizely.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/overloop/overloop.go b/pkg/detectors/overloop/overloop.go index 61310545c034..2a38895f4907 100644 --- a/pkg/detectors/overloop/overloop.go +++ b/pkg/detectors/overloop/overloop.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/owlbot/owlbot.go b/pkg/detectors/owlbot/owlbot.go index d8ca5fea1c09..7b68828af724 100644 --- a/pkg/detectors/owlbot/owlbot.go +++ b/pkg/detectors/owlbot/owlbot.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/packagecloud/packagecloud.go b/pkg/detectors/packagecloud/packagecloud.go index f7ec0ffb05ba..0eb9e71c30f0 100644 --- a/pkg/detectors/packagecloud/packagecloud.go +++ b/pkg/detectors/packagecloud/packagecloud.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go b/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go index 815641c7acec..8acd8f16d06c 100644 --- a/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go +++ b/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go @@ -3,10 +3,11 @@ package pagerdutyapikey import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pandadoc/pandadoc.go b/pkg/detectors/pandadoc/pandadoc.go index 2c8a579c64c2..12aec603e5e6 100644 --- a/pkg/detectors/pandadoc/pandadoc.go +++ b/pkg/detectors/pandadoc/pandadoc.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pandascore/pandascore.go b/pkg/detectors/pandascore/pandascore.go index 23e54577e817..0988e9295f74 100644 --- a/pkg/detectors/pandascore/pandascore.go +++ b/pkg/detectors/pandascore/pandascore.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paperform/paperform.go b/pkg/detectors/paperform/paperform.go index 06e364a5c328..0120aa1d1b6d 100644 --- a/pkg/detectors/paperform/paperform.go +++ b/pkg/detectors/paperform/paperform.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paralleldots/paralleldots.go b/pkg/detectors/paralleldots/paralleldots.go index 1af81ee282af..738b6df21414 100644 --- a/pkg/detectors/paralleldots/paralleldots.go +++ b/pkg/detectors/paralleldots/paralleldots.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/parsehub/parsehub.go b/pkg/detectors/parsehub/parsehub.go index 7da8861ae136..f0d9db845c25 100644 --- a/pkg/detectors/parsehub/parsehub.go +++ b/pkg/detectors/parsehub/parsehub.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/parsers/parsers.go b/pkg/detectors/parsers/parsers.go index 3114283418cf..8dbf9ca71ecf 100644 --- a/pkg/detectors/parsers/parsers.go +++ b/pkg/detectors/parsers/parsers.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/parseur/parseur.go b/pkg/detectors/parseur/parseur.go index f0e7dce37122..c73f731cea22 100644 --- a/pkg/detectors/parseur/parseur.go +++ b/pkg/detectors/parseur/parseur.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/partnerstack/partnerstack.go b/pkg/detectors/partnerstack/partnerstack.go index a0a81cc0be99..f8e1f30f9ed5 100644 --- a/pkg/detectors/partnerstack/partnerstack.go +++ b/pkg/detectors/partnerstack/partnerstack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pastebin/pastebin.go b/pkg/detectors/pastebin/pastebin.go index 7e1abaaced38..657aac0eaec3 100644 --- a/pkg/detectors/pastebin/pastebin.go +++ b/pkg/detectors/pastebin/pastebin.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paydirtapp/paydirtapp.go b/pkg/detectors/paydirtapp/paydirtapp.go index d74acd9d2b4d..4f88a76a3b0e 100644 --- a/pkg/detectors/paydirtapp/paydirtapp.go +++ b/pkg/detectors/paydirtapp/paydirtapp.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paymoapp/paymoapp.go b/pkg/detectors/paymoapp/paymoapp.go index 13a9f4b413d5..eb19cbec6cf3 100644 --- a/pkg/detectors/paymoapp/paymoapp.go +++ b/pkg/detectors/paymoapp/paymoapp.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paymongo/paymongo.go b/pkg/detectors/paymongo/paymongo.go index 4ff0ab7b8e98..e13b1bc101eb 100644 --- a/pkg/detectors/paymongo/paymongo.go +++ b/pkg/detectors/paymongo/paymongo.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paypaloauth/paypaloauth.go b/pkg/detectors/paypaloauth/paypaloauth.go index c52de5d51b43..2a6828ac7e85 100644 --- a/pkg/detectors/paypaloauth/paypaloauth.go +++ b/pkg/detectors/paypaloauth/paypaloauth.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idmatches { - if len(idMatch) != 2 { - continue - } resIDMatch := strings.TrimSpace(idMatch[1]) for _, secretMatch := range matches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/paystack/paystack.go b/pkg/detectors/paystack/paystack.go index f7ee3c37da97..c03f4c1fd4fa 100644 --- a/pkg/detectors/paystack/paystack.go +++ b/pkg/detectors/paystack/paystack.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pdflayer/pdflayer.go b/pkg/detectors/pdflayer/pdflayer.go index e83d98957ec5..bae3d47b69bd 100644 --- a/pkg/detectors/pdflayer/pdflayer.go +++ b/pkg/detectors/pdflayer/pdflayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pdfshift/pdfshift.go b/pkg/detectors/pdfshift/pdfshift.go index 9b480bcad279..aa74f81f9022 100644 --- a/pkg/detectors/pdfshift/pdfshift.go +++ b/pkg/detectors/pdfshift/pdfshift.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/peopledatalabs/peopledatalabs.go b/pkg/detectors/peopledatalabs/peopledatalabs.go index bb406e373a2c..a4bfc66639d7 100644 --- a/pkg/detectors/peopledatalabs/peopledatalabs.go +++ b/pkg/detectors/peopledatalabs/peopledatalabs.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pepipost/pepipost.go b/pkg/detectors/pepipost/pepipost.go index 7a62e68045c0..5e51c49fb0be 100644 --- a/pkg/detectors/pepipost/pepipost.go +++ b/pkg/detectors/pepipost/pepipost.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/percy/percy.go b/pkg/detectors/percy/percy.go index ca6e64ae757a..33444a736493 100644 --- a/pkg/detectors/percy/percy.go +++ b/pkg/detectors/percy/percy.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pinata/pinata.go b/pkg/detectors/pinata/pinata.go index 5103a2348da8..6bfe467b4cbb 100644 --- a/pkg/detectors/pinata/pinata.go +++ b/pkg/detectors/pinata/pinata.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/pipedream/pipedream.go b/pkg/detectors/pipedream/pipedream.go index ea0d4d8aaa9d..e61ec3a126e7 100644 --- a/pkg/detectors/pipedream/pipedream.go +++ b/pkg/detectors/pipedream/pipedream.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pipedrive/pipedrive.go b/pkg/detectors/pipedrive/pipedrive.go index 09ef200ba92e..593579ffc734 100644 --- a/pkg/detectors/pipedrive/pipedrive.go +++ b/pkg/detectors/pipedrive/pipedrive.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pivotaltracker/pivotaltracker.go b/pkg/detectors/pivotaltracker/pivotaltracker.go index d0e37ce4f187..172ebc25499c 100644 --- a/pkg/detectors/pivotaltracker/pivotaltracker.go +++ b/pkg/detectors/pivotaltracker/pivotaltracker.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result for _, match := range matches { // First match is entire regex, second is the first group. - if len(match) != 2 { - continue - } token := match[1] diff --git a/pkg/detectors/pixabay/pixabay.go b/pkg/detectors/pixabay/pixabay.go index df09f2f05b74..1d653a44ffed 100644 --- a/pkg/detectors/pixabay/pixabay.go +++ b/pkg/detectors/pixabay/pixabay.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/plaidkey/plaidkey.go b/pkg/detectors/plaidkey/plaidkey.go index 365ac7daffcc..c81ef4956bb4 100644 --- a/pkg/detectors/plaidkey/plaidkey.go +++ b/pkg/detectors/plaidkey/plaidkey.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } idresMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/planviewleankit/planviewleankit.go b/pkg/detectors/planviewleankit/planviewleankit.go index 7380716ebf3c..77b18ef39c82 100644 --- a/pkg/detectors/planviewleankit/planviewleankit.go +++ b/pkg/detectors/planviewleankit/planviewleankit.go @@ -3,10 +3,11 @@ package planviewleankit import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result subdomainMatches := subDomainPat.FindAllStringSubmatch(dataStr, -1) for _, subdomainMatch := range subdomainMatches { - if len(subdomainMatch) != 2 { - continue - } resSubdomainMatch := strings.TrimSpace(subdomainMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/planyo/planyo.go b/pkg/detectors/planyo/planyo.go index e5a33be83c59..89c23d0597b7 100644 --- a/pkg/detectors/planyo/planyo.go +++ b/pkg/detectors/planyo/planyo.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/plivo/plivo.go b/pkg/detectors/plivo/plivo.go index 28fd635ab0d4..91759736e392 100644 --- a/pkg/detectors/plivo/plivo.go +++ b/pkg/detectors/plivo/plivo.go @@ -38,14 +38,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } id := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/podio/podio.go b/pkg/detectors/podio/podio.go index 3978c4266cb3..e43e53cf90e3 100644 --- a/pkg/detectors/podio/podio.go +++ b/pkg/detectors/podio/podio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pollsapi/pollsapi.go b/pkg/detectors/pollsapi/pollsapi.go index 6d305def6abe..4c44ed552de7 100644 --- a/pkg/detectors/pollsapi/pollsapi.go +++ b/pkg/detectors/pollsapi/pollsapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/poloniex/poloniex.go b/pkg/detectors/poloniex/poloniex.go index 8c7a0c3591b0..49ee0e9392fd 100644 --- a/pkg/detectors/poloniex/poloniex.go +++ b/pkg/detectors/poloniex/poloniex.go @@ -44,15 +44,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/polygon/polygon.go b/pkg/detectors/polygon/polygon.go index d3da6a4ce06f..4dd6a587f273 100644 --- a/pkg/detectors/polygon/polygon.go +++ b/pkg/detectors/polygon/polygon.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/portainer/portainer.go b/pkg/detectors/portainer/portainer.go index fa93bc65e509..f8e931def26f 100644 --- a/pkg/detectors/portainer/portainer.go +++ b/pkg/detectors/portainer/portainer.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result endpointMatches := endpointPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, endpointMatch := range endpointMatches { diff --git a/pkg/detectors/portainertoken/portainertoken.go b/pkg/detectors/portainertoken/portainertoken.go index f3925a6edefd..a6011ba72c51 100644 --- a/pkg/detectors/portainertoken/portainertoken.go +++ b/pkg/detectors/portainertoken/portainertoken.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result endpointMatches := endpointPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, endpointMatch := range endpointMatches { diff --git a/pkg/detectors/positionstack/positionstack.go b/pkg/detectors/positionstack/positionstack.go index 7001be4516a9..e46dd2c70da4 100644 --- a/pkg/detectors/positionstack/positionstack.go +++ b/pkg/detectors/positionstack/positionstack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/postageapp/postageapp.go b/pkg/detectors/postageapp/postageapp.go index 3f119e824d04..11f56f83c845 100644 --- a/pkg/detectors/postageapp/postageapp.go +++ b/pkg/detectors/postageapp/postageapp.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/postbacks/postbacks.go b/pkg/detectors/postbacks/postbacks.go index 8c4c00f22903..afa39c06bc74 100644 --- a/pkg/detectors/postbacks/postbacks.go +++ b/pkg/detectors/postbacks/postbacks.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/posthog/posthog.go b/pkg/detectors/posthog/posthog.go index ca47572c478e..6dbbf43ba8c3 100644 --- a/pkg/detectors/posthog/posthog.go +++ b/pkg/detectors/posthog/posthog.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/postman/postman.go b/pkg/detectors/postman/postman.go index bc25323f4f60..e24c541bfca0 100644 --- a/pkg/detectors/postman/postman.go +++ b/pkg/detectors/postman/postman.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/postmark/postmark.go b/pkg/detectors/postmark/postmark.go index 1ffe18df0707..a12dda902784 100644 --- a/pkg/detectors/postmark/postmark.go +++ b/pkg/detectors/postmark/postmark.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/powrbot/powrbot.go b/pkg/detectors/powrbot/powrbot.go index 16b7790fd9a2..8941ee5860a9 100644 --- a/pkg/detectors/powrbot/powrbot.go +++ b/pkg/detectors/powrbot/powrbot.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/prefect/prefect.go b/pkg/detectors/prefect/prefect.go index c9d6dc0a215a..1f31d335ecca 100644 --- a/pkg/detectors/prefect/prefect.go +++ b/pkg/detectors/prefect/prefect.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/privacy/privacy.go b/pkg/detectors/privacy/privacy.go index f85a3ad6215d..fb520a18e4e9 100644 --- a/pkg/detectors/privacy/privacy.go +++ b/pkg/detectors/privacy/privacy.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/prodpad/prodpad.go b/pkg/detectors/prodpad/prodpad.go index 384ff3e21627..e159109cf4d9 100644 --- a/pkg/detectors/prodpad/prodpad.go +++ b/pkg/detectors/prodpad/prodpad.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/prospectcrm/prospectcrm.go b/pkg/detectors/prospectcrm/prospectcrm.go index fcfeb462986a..fc3543606b65 100644 --- a/pkg/detectors/prospectcrm/prospectcrm.go +++ b/pkg/detectors/prospectcrm/prospectcrm.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/protocolsio/protocolsio.go b/pkg/detectors/protocolsio/protocolsio.go index 4ffa176e8209..2c4a264209f1 100644 --- a/pkg/detectors/protocolsio/protocolsio.go +++ b/pkg/detectors/protocolsio/protocolsio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/proxycrawl/proxycrawl.go b/pkg/detectors/proxycrawl/proxycrawl.go index 86b56ebb2f77..4e6b79b66ee5 100644 --- a/pkg/detectors/proxycrawl/proxycrawl.go +++ b/pkg/detectors/proxycrawl/proxycrawl.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go b/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go index 656637799e65..8cdf39c2c045 100644 --- a/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go +++ b/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go @@ -3,10 +3,11 @@ package pubnubpublishkey import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,15 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result subMatches := subPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, subMatch := range subMatches { - if len(subMatch) != 2 { - continue - } ressubMatch := strings.TrimSpace(subMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go b/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go index f5017000f515..6926b1b4f0e0 100644 --- a/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go +++ b/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go @@ -2,10 +2,11 @@ package pubnubsubscriptionkey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pulumi/pulumi.go b/pkg/detectors/pulumi/pulumi.go index 27ce74f789a6..9a0fd78e45fb 100644 --- a/pkg/detectors/pulumi/pulumi.go +++ b/pkg/detectors/pulumi/pulumi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/purestake/purestake.go b/pkg/detectors/purestake/purestake.go index 831fa5b18880..be35e92daf8e 100644 --- a/pkg/detectors/purestake/purestake.go +++ b/pkg/detectors/purestake/purestake.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pushbulletapikey/pushbulletapikey.go b/pkg/detectors/pushbulletapikey/pushbulletapikey.go index 715c6c49f193..d3d515f5e47e 100644 --- a/pkg/detectors/pushbulletapikey/pushbulletapikey.go +++ b/pkg/detectors/pushbulletapikey/pushbulletapikey.go @@ -2,10 +2,11 @@ package pushbulletapikey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/pusherchannelkey/pusherchannelkey.go b/pkg/detectors/pusherchannelkey/pusherchannelkey.go index 1e56891daaed..f4c67b91e3b8 100644 --- a/pkg/detectors/pusherchannelkey/pusherchannelkey.go +++ b/pkg/detectors/pusherchannelkey/pusherchannelkey.go @@ -52,21 +52,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, appMatch := range appMatches { - if len(appMatch) != 2 { - continue - } resappMatch := strings.TrimSpace(appMatch[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } reskeyMatch := strings.TrimSpace(keyMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } ressecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/qase/qase.go b/pkg/detectors/qase/qase.go index d4eaf50df157..90008e2cc928 100644 --- a/pkg/detectors/qase/qase.go +++ b/pkg/detectors/qase/qase.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/qualaroo/qualaroo.go b/pkg/detectors/qualaroo/qualaroo.go index 2a5341d34adb..8a8d746b68f6 100644 --- a/pkg/detectors/qualaroo/qualaroo.go +++ b/pkg/detectors/qualaroo/qualaroo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/qubole/qubole.go b/pkg/detectors/qubole/qubole.go index 39932a72a255..d9e433c6b08c 100644 --- a/pkg/detectors/qubole/qubole.go +++ b/pkg/detectors/qubole/qubole.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/ramp/ramp.go b/pkg/detectors/ramp/ramp.go index fb03a0ac2213..d7f35833a52c 100644 --- a/pkg/detectors/ramp/ramp.go +++ b/pkg/detectors/ramp/ramp.go @@ -3,11 +3,12 @@ package ramp import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "net/url" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -41,16 +42,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } - resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) diff --git a/pkg/detectors/rapidapi/rapidapi.go b/pkg/detectors/rapidapi/rapidapi.go index 38ee1791d822..87b58d074a32 100644 --- a/pkg/detectors/rapidapi/rapidapi.go +++ b/pkg/detectors/rapidapi/rapidapi.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/raven/raven.go b/pkg/detectors/raven/raven.go index 92bce8be0e21..383ce5fa4e1b 100644 --- a/pkg/detectors/raven/raven.go +++ b/pkg/detectors/raven/raven.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rawg/rawg.go b/pkg/detectors/rawg/rawg.go index 464e0eca0261..9285f984f648 100644 --- a/pkg/detectors/rawg/rawg.go +++ b/pkg/detectors/rawg/rawg.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/reachmail/reachmail.go b/pkg/detectors/reachmail/reachmail.go index 7756c5099baa..b5bfb61bd514 100644 --- a/pkg/detectors/reachmail/reachmail.go +++ b/pkg/detectors/reachmail/reachmail.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/readme/readme.go b/pkg/detectors/readme/readme.go index ecb4826f5950..d762e4ccda0e 100644 --- a/pkg/detectors/readme/readme.go +++ b/pkg/detectors/readme/readme.go @@ -34,9 +34,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/reallysimplesystems/reallysimplesystems.go b/pkg/detectors/reallysimplesystems/reallysimplesystems.go index a8eb0cbe7233..a47d9ca2c32d 100644 --- a/pkg/detectors/reallysimplesystems/reallysimplesystems.go +++ b/pkg/detectors/reallysimplesystems/reallysimplesystems.go @@ -4,11 +4,12 @@ import ( "context" "encoding/json" "fmt" - regexp "github.com/wasilibs/go-re2" "io" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rebrandly/rebrandly.go b/pkg/detectors/rebrandly/rebrandly.go index 16057153ba3c..073d5a9fe756 100644 --- a/pkg/detectors/rebrandly/rebrandly.go +++ b/pkg/detectors/rebrandly/rebrandly.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/refiner/refiner.go b/pkg/detectors/refiner/refiner.go index 924fc000b0d0..13a98c57a577 100644 --- a/pkg/detectors/refiner/refiner.go +++ b/pkg/detectors/refiner/refiner.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rentman/rentman.go b/pkg/detectors/rentman/rentman.go index d7f23577feb1..798f352b50dd 100644 --- a/pkg/detectors/rentman/rentman.go +++ b/pkg/detectors/rentman/rentman.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/repairshopr/repairshopr.go b/pkg/detectors/repairshopr/repairshopr.go index c702cbbeb627..9f0a898e3fd9 100644 --- a/pkg/detectors/repairshopr/repairshopr.go +++ b/pkg/detectors/repairshopr/repairshopr.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainmatch := range domainMatches { - if len(match) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Repairshopr, diff --git a/pkg/detectors/replicate/replicate.go b/pkg/detectors/replicate/replicate.go index 229083ef562a..4af6b258caf4 100644 --- a/pkg/detectors/replicate/replicate.go +++ b/pkg/detectors/replicate/replicate.go @@ -34,9 +34,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/replyio/replyio.go b/pkg/detectors/replyio/replyio.go index 4d1164a1b8b4..ef4c28613656 100644 --- a/pkg/detectors/replyio/replyio.go +++ b/pkg/detectors/replyio/replyio.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/requestfinance/requestfinance.go b/pkg/detectors/requestfinance/requestfinance.go index 815362520ef2..bc7c0ff96fe6 100644 --- a/pkg/detectors/requestfinance/requestfinance.go +++ b/pkg/detectors/requestfinance/requestfinance.go @@ -3,10 +3,11 @@ package requestfinance import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/restpack/restpack.go b/pkg/detectors/restpack/restpack.go index 2f2e43804c09..a916bc5bf20d 100644 --- a/pkg/detectors/restpack/restpack.go +++ b/pkg/detectors/restpack/restpack.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go b/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go index 2935df58687b..0c1c6d9ab7c6 100644 --- a/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go +++ b/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go @@ -2,10 +2,11 @@ package restpackhtmltopdfapi import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go b/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go index 2e62c04cf51c..8ed4aa41a237 100644 --- a/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go +++ b/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go @@ -2,10 +2,11 @@ package restpackscreenshotapi import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rev/rev.go b/pkg/detectors/rev/rev.go index 8ca7a49793e9..f58083f03c4c 100644 --- a/pkg/detectors/rev/rev.go +++ b/pkg/detectors/rev/rev.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result clientMatches := clientKeyPat.FindAllStringSubmatch(dataStr, -1) for _, userMatch := range userMatches { - if len(userMatch) != 2 { - continue - } resUserMatch := strings.TrimSpace(userMatch[1]) for _, clientMatch := range clientMatches { - if len(clientMatch) != 2 { - continue - } resClientMatch := strings.TrimSpace(clientMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/revampcrm/revampcrm.go b/pkg/detectors/revampcrm/revampcrm.go index 2c9d2ca842e5..71498405f29d 100644 --- a/pkg/detectors/revampcrm/revampcrm.go +++ b/pkg/detectors/revampcrm/revampcrm.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/ringcentral/ringcentral.go b/pkg/detectors/ringcentral/ringcentral.go index f20268656d46..6cd2b3dea8fb 100644 --- a/pkg/detectors/ringcentral/ringcentral.go +++ b/pkg/detectors/ringcentral/ringcentral.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result uriMatches := uriPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, uriMatch := range uriMatches { - if len(uriMatch) != 2 { - continue - } resURI := strings.TrimSpace(uriMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_RingCentral, diff --git a/pkg/detectors/ritekit/ritekit.go b/pkg/detectors/ritekit/ritekit.go index 5fdd7d24133f..cd851619bf92 100644 --- a/pkg/detectors/ritekit/ritekit.go +++ b/pkg/detectors/ritekit/ritekit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/roaring/roaring.go b/pkg/detectors/roaring/roaring.go index 356d0914ad84..cda5021c3ddb 100644 --- a/pkg/detectors/roaring/roaring.go +++ b/pkg/detectors/roaring/roaring.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, clientMatch := range clientMatches { - if len(clientMatch) != 2 { - continue - } resClient := strings.TrimSpace(clientMatch[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rocketreach/rocketreach.go b/pkg/detectors/rocketreach/rocketreach.go index f706e791bb24..dda8c93220f7 100644 --- a/pkg/detectors/rocketreach/rocketreach.go +++ b/pkg/detectors/rocketreach/rocketreach.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rockset/rockset.go b/pkg/detectors/rockset/rockset.go index de3baa50748f..318968d24543 100644 --- a/pkg/detectors/rockset/rockset.go +++ b/pkg/detectors/rockset/rockset.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/roninapp/roninapp.go b/pkg/detectors/roninapp/roninapp.go index 020af64505b7..5ffd522488fe 100644 --- a/pkg/detectors/roninapp/roninapp.go +++ b/pkg/detectors/roninapp/roninapp.go @@ -41,15 +41,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_RoninApp, diff --git a/pkg/detectors/route4me/route4me.go b/pkg/detectors/route4me/route4me.go index dbebd51304e1..2058dc5f179c 100644 --- a/pkg/detectors/route4me/route4me.go +++ b/pkg/detectors/route4me/route4me.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/rownd/rownd.go b/pkg/detectors/rownd/rownd.go index 67aab70b2b36..f3691428bb7a 100644 --- a/pkg/detectors/rownd/rownd.go +++ b/pkg/detectors/rownd/rownd.go @@ -40,21 +40,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resId := strings.TrimSpace(idMatch[1]) for _, match := range keyMatches { - if len(match) != 2 { - continue - } keyMatch := strings.TrimSpace(match[1]) for _, secret := range secretMatches { - if len(secret) != 2 { - continue - } secretMatch := strings.TrimSpace(secret[1]) diff --git a/pkg/detectors/rubygems/rubygems.go b/pkg/detectors/rubygems/rubygems.go index c90da120ce4d..e017da8fd50f 100644 --- a/pkg/detectors/rubygems/rubygems.go +++ b/pkg/detectors/rubygems/rubygems.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/runrunit/runrunit.go b/pkg/detectors/runrunit/runrunit.go index 4df932dbd51a..c1beab051c56 100644 --- a/pkg/detectors/runrunit/runrunit.go +++ b/pkg/detectors/runrunit/runrunit.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userTokenMatches := userTokenPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userTokenMatch := range userTokenMatches { - if len(userTokenMatch) != 2 { - continue - } resUserTokenMatch := strings.TrimSpace(userTokenMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/salesblink/salesblink.go b/pkg/detectors/salesblink/salesblink.go index 0a8a07633ba5..4b3666d52eef 100644 --- a/pkg/detectors/salesblink/salesblink.go +++ b/pkg/detectors/salesblink/salesblink.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/salescookie/salescookie.go b/pkg/detectors/salescookie/salescookie.go index 9cd4a071a35b..a8ce79c30c58 100644 --- a/pkg/detectors/salescookie/salescookie.go +++ b/pkg/detectors/salescookie/salescookie.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/salesflare/salesflare.go b/pkg/detectors/salesflare/salesflare.go index ee62c241a588..766412413613 100644 --- a/pkg/detectors/salesflare/salesflare.go +++ b/pkg/detectors/salesflare/salesflare.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/salesforce/salesforce.go b/pkg/detectors/salesforce/salesforce.go index de2bb365bb94..71bcf9a3b97e 100644 --- a/pkg/detectors/salesforce/salesforce.go +++ b/pkg/detectors/salesforce/salesforce.go @@ -44,16 +44,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result tokenMatches := accessTokenPat.FindAllStringSubmatch(dataStr, -1) for _, instance := range instanceMatches { - if len(instance) != 1 { - continue - } instanceMatch := strings.TrimSpace(instance[0]) for _, token := range tokenMatches { - if len(token) != 1 { - continue - } tokenMatch := strings.TrimSpace(token[0]) diff --git a/pkg/detectors/salesmate/salesmate.go b/pkg/detectors/salesmate/salesmate.go index 273928a2c43c..90920d881531 100644 --- a/pkg/detectors/salesmate/salesmate.go +++ b/pkg/detectors/salesmate/salesmate.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := domainPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Salesmate, diff --git a/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go b/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go index 01bcdb9d3ab3..79a4b6bff6c6 100644 --- a/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go +++ b/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go @@ -4,10 +4,11 @@ import ( "context" b64 "encoding/base64" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -42,21 +43,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passmatches := passPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, emailmatch := range emailmatches { - if len(emailmatch) != 2 { - continue - } resEmailMatch := strings.TrimSpace(emailmatch[1]) for _, passmatch := range passmatches { - if len(passmatch) != 2 { - continue - } resPassMatch := strings.TrimSpace(passmatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/satismeterwritekey/satismeterwritekey.go b/pkg/detectors/satismeterwritekey/satismeterwritekey.go index d49aa91b9e2f..c55ea5e54d29 100644 --- a/pkg/detectors/satismeterwritekey/satismeterwritekey.go +++ b/pkg/detectors/satismeterwritekey/satismeterwritekey.go @@ -2,10 +2,11 @@ package satismeterwritekey import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/saucelabs/saucelabs.go b/pkg/detectors/saucelabs/saucelabs.go index 9544a0cbd936..2baec060b4e1 100644 --- a/pkg/detectors/saucelabs/saucelabs.go +++ b/pkg/detectors/saucelabs/saucelabs.go @@ -40,16 +40,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } idMatch := strings.TrimSpace(match[1]) for _, secret := range keyMatches { - if len(secret) != 2 { - continue - } keyMatch := strings.TrimSpace(secret[1]) diff --git a/pkg/detectors/scalewaykey/scalewaykey.go b/pkg/detectors/scalewaykey/scalewaykey.go index daaf76d205ce..06e527b0356d 100644 --- a/pkg/detectors/scalewaykey/scalewaykey.go +++ b/pkg/detectors/scalewaykey/scalewaykey.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scalr/scalr.go b/pkg/detectors/scalr/scalr.go index a2a80c39fb03..c4cf63334005 100644 --- a/pkg/detectors/scalr/scalr.go +++ b/pkg/detectors/scalr/scalr.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Scalr, diff --git a/pkg/detectors/scrapeowl/scrapeowl.go b/pkg/detectors/scrapeowl/scrapeowl.go index 566383b00c09..f2da57eed3e3 100644 --- a/pkg/detectors/scrapeowl/scrapeowl.go +++ b/pkg/detectors/scrapeowl/scrapeowl.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scraperapi/scraperapi.go b/pkg/detectors/scraperapi/scraperapi.go index a693748683be..479da753da09 100644 --- a/pkg/detectors/scraperapi/scraperapi.go +++ b/pkg/detectors/scraperapi/scraperapi.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result dataStr := string(data) matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scraperbox/scraperbox.go b/pkg/detectors/scraperbox/scraperbox.go index 1d5439f8d5cd..f10edf8efdae 100644 --- a/pkg/detectors/scraperbox/scraperbox.go +++ b/pkg/detectors/scraperbox/scraperbox.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrapestack/scrapestack.go b/pkg/detectors/scrapestack/scrapestack.go index 4f57b751e702..baddaff0621f 100644 --- a/pkg/detectors/scrapestack/scrapestack.go +++ b/pkg/detectors/scrapestack/scrapestack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrapfly/scrapfly.go b/pkg/detectors/scrapfly/scrapfly.go index ce97f374afbd..006fb34dea98 100644 --- a/pkg/detectors/scrapfly/scrapfly.go +++ b/pkg/detectors/scrapfly/scrapfly.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrapingant/scrapingant.go b/pkg/detectors/scrapingant/scrapingant.go index 5aba39bfa7db..4c9502fcffa4 100644 --- a/pkg/detectors/scrapingant/scrapingant.go +++ b/pkg/detectors/scrapingant/scrapingant.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrapingbee/scrapingbee.go b/pkg/detectors/scrapingbee/scrapingbee.go index 9f9c654bd1d7..491b56960837 100644 --- a/pkg/detectors/scrapingbee/scrapingbee.go +++ b/pkg/detectors/scrapingbee/scrapingbee.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/screenshotapi/screenshotapi.go b/pkg/detectors/screenshotapi/screenshotapi.go index dfbbef53c043..78b5a750ced8 100644 --- a/pkg/detectors/screenshotapi/screenshotapi.go +++ b/pkg/detectors/screenshotapi/screenshotapi.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/screenshotlayer/screenshotlayer.go b/pkg/detectors/screenshotlayer/screenshotlayer.go index 39c174e274b3..14a835515b40 100644 --- a/pkg/detectors/screenshotlayer/screenshotlayer.go +++ b/pkg/detectors/screenshotlayer/screenshotlayer.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/scrutinizerci/scrutinizerci.go b/pkg/detectors/scrutinizerci/scrutinizerci.go index b662b331ad45..fbafbb329789 100644 --- a/pkg/detectors/scrutinizerci/scrutinizerci.go +++ b/pkg/detectors/scrutinizerci/scrutinizerci.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/securitytrails/securitytrails.go b/pkg/detectors/securitytrails/securitytrails.go index 84bfe0ba6f8d..0ebfeb637db8 100644 --- a/pkg/detectors/securitytrails/securitytrails.go +++ b/pkg/detectors/securitytrails/securitytrails.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/segmentapikey/segmentapikey.go b/pkg/detectors/segmentapikey/segmentapikey.go index f3d2ba891757..02e2c4e090fa 100644 --- a/pkg/detectors/segmentapikey/segmentapikey.go +++ b/pkg/detectors/segmentapikey/segmentapikey.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/selectpdf/selectpdf.go b/pkg/detectors/selectpdf/selectpdf.go index e3993a03ec18..d4dd2d5c8afe 100644 --- a/pkg/detectors/selectpdf/selectpdf.go +++ b/pkg/detectors/selectpdf/selectpdf.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/semaphore/semaphore.go b/pkg/detectors/semaphore/semaphore.go index 098d71bddd72..edfd4ba747f1 100644 --- a/pkg/detectors/semaphore/semaphore.go +++ b/pkg/detectors/semaphore/semaphore.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) if !detectors.HasDigit(resMatch) { diff --git a/pkg/detectors/sendbird/sendbird.go b/pkg/detectors/sendbird/sendbird.go index 51fe9165ad4b..a3680a190998 100644 --- a/pkg/detectors/sendbird/sendbird.go +++ b/pkg/detectors/sendbird/sendbird.go @@ -46,15 +46,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result appIdMatches := appIdPat.FindAllStringSubmatch(dataStr, -1) for _, appIdMatch := range appIdMatches { - if len(appIdMatch) != 2 { - continue - } resAppIdMatch := strings.TrimSpace(appIdMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go b/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go index 6bc71aa0f7dc..a4939e12b960 100644 --- a/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go +++ b/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go @@ -3,10 +3,11 @@ package sendbirdorganizationapi import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -39,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sendinbluev2/sendinbluev2.go b/pkg/detectors/sendinbluev2/sendinbluev2.go index e33eac6c7528..7a60428794ab 100644 --- a/pkg/detectors/sendinbluev2/sendinbluev2.go +++ b/pkg/detectors/sendinbluev2/sendinbluev2.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sentrytoken/sentrytoken.go b/pkg/detectors/sentrytoken/sentrytoken.go index ce73fdd65a72..d1bd0519e507 100644 --- a/pkg/detectors/sentrytoken/sentrytoken.go +++ b/pkg/detectors/sentrytoken/sentrytoken.go @@ -44,9 +44,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_SentryToken, diff --git a/pkg/detectors/serphouse/serphouse.go b/pkg/detectors/serphouse/serphouse.go index 7dfd7ba01d69..3c7f9e01d06e 100644 --- a/pkg/detectors/serphouse/serphouse.go +++ b/pkg/detectors/serphouse/serphouse.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/serpstack/serpstack.go b/pkg/detectors/serpstack/serpstack.go index fb92a530a7a0..b9c94b315951 100644 --- a/pkg/detectors/serpstack/serpstack.go +++ b/pkg/detectors/serpstack/serpstack.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sheety/sheety.go b/pkg/detectors/sheety/sheety.go index 5f990d1a5f91..d4ce66821c2c 100644 --- a/pkg/detectors/sheety/sheety.go +++ b/pkg/detectors/sheety/sheety.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/sherpadesk/sherpadesk.go b/pkg/detectors/sherpadesk/sherpadesk.go index 79bcee05bf93..e6ae7ae1e169 100644 --- a/pkg/detectors/sherpadesk/sherpadesk.go +++ b/pkg/detectors/sherpadesk/sherpadesk.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shipday/shipday.go b/pkg/detectors/shipday/shipday.go index 97474c345e1a..1c76b0004893 100644 --- a/pkg/detectors/shipday/shipday.go +++ b/pkg/detectors/shipday/shipday.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shodankey/shodankey.go b/pkg/detectors/shodankey/shodankey.go index 58a66b01522a..edcd89b87f46 100644 --- a/pkg/detectors/shodankey/shodankey.go +++ b/pkg/detectors/shodankey/shodankey.go @@ -39,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shortcut/shortcut.go b/pkg/detectors/shortcut/shortcut.go index 764e548ef009..8a92f12fdfa1 100644 --- a/pkg/detectors/shortcut/shortcut.go +++ b/pkg/detectors/shortcut/shortcut.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shotstack/shotstack.go b/pkg/detectors/shotstack/shotstack.go index b3d46f752e30..ae6af8dcd1c9 100644 --- a/pkg/detectors/shotstack/shotstack.go +++ b/pkg/detectors/shotstack/shotstack.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shutterstock/shutterstock.go b/pkg/detectors/shutterstock/shutterstock.go index c097d8202e09..4ea64f111782 100644 --- a/pkg/detectors/shutterstock/shutterstock.go +++ b/pkg/detectors/shutterstock/shutterstock.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/shutterstockoauth/shutterstockoauth.go b/pkg/detectors/shutterstockoauth/shutterstockoauth.go index 5f9076b43cba..f9fc1e19c79c 100644 --- a/pkg/detectors/shutterstockoauth/shutterstockoauth.go +++ b/pkg/detectors/shutterstockoauth/shutterstockoauth.go @@ -3,10 +3,11 @@ package shutterstockoauth import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/signable/signable.go b/pkg/detectors/signable/signable.go index 8e13d562a99d..d2e80b16f702 100644 --- a/pkg/detectors/signable/signable.go +++ b/pkg/detectors/signable/signable.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := tokenPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } if isCommonFalsePositive(match[0]) { continue diff --git a/pkg/detectors/signalwire/signalwire.go b/pkg/detectors/signalwire/signalwire.go index a617a867c816..58a4ce82a56e 100644 --- a/pkg/detectors/signalwire/signalwire.go +++ b/pkg/detectors/signalwire/signalwire.go @@ -42,21 +42,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result urlMatches := urlPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resID := strings.TrimSpace(idMatch[1]) for _, urlMatch := range urlMatches { - if len(urlMatch) != 2 { - continue - } resURL := strings.TrimSpace(urlMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/signaturit/signaturit.go b/pkg/detectors/signaturit/signaturit.go index c34b712b013c..6fb6ea44ccb1 100644 --- a/pkg/detectors/signaturit/signaturit.go +++ b/pkg/detectors/signaturit/signaturit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/signupgenius/signupgenius.go b/pkg/detectors/signupgenius/signupgenius.go index 044e8614b24d..23fc147af592 100644 --- a/pkg/detectors/signupgenius/signupgenius.go +++ b/pkg/detectors/signupgenius/signupgenius.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sigopt/sigopt.go b/pkg/detectors/sigopt/sigopt.go index 4055f93d2782..47d5bfe7e712 100644 --- a/pkg/detectors/sigopt/sigopt.go +++ b/pkg/detectors/sigopt/sigopt.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/simfin/simfin.go b/pkg/detectors/simfin/simfin.go index 1fce9b07c449..ed34038438b5 100644 --- a/pkg/detectors/simfin/simfin.go +++ b/pkg/detectors/simfin/simfin.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/simplesat/simplesat.go b/pkg/detectors/simplesat/simplesat.go index 9cea1ae9adb4..7082c8450dae 100644 --- a/pkg/detectors/simplesat/simplesat.go +++ b/pkg/detectors/simplesat/simplesat.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/simplynoted/simplynoted.go b/pkg/detectors/simplynoted/simplynoted.go index ea07439db117..12d4880ab3dd 100644 --- a/pkg/detectors/simplynoted/simplynoted.go +++ b/pkg/detectors/simplynoted/simplynoted.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/simvoly/simvoly.go b/pkg/detectors/simvoly/simvoly.go index 935265f227ac..1cce165788a4 100644 --- a/pkg/detectors/simvoly/simvoly.go +++ b/pkg/detectors/simvoly/simvoly.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sinchmessage/sinchmessage.go b/pkg/detectors/sinchmessage/sinchmessage.go index eb67ecb7c6db..9ca38b7968c2 100644 --- a/pkg/detectors/sinchmessage/sinchmessage.go +++ b/pkg/detectors/sinchmessage/sinchmessage.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/sirv/sirv.go b/pkg/detectors/sirv/sirv.go index b6a7531a69b8..b5a31d1d6bea 100644 --- a/pkg/detectors/sirv/sirv.go +++ b/pkg/detectors/sirv/sirv.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/siteleaf/siteleaf.go b/pkg/detectors/siteleaf/siteleaf.go index a3a3bcabd2e8..839aabde9891 100644 --- a/pkg/detectors/siteleaf/siteleaf.go +++ b/pkg/detectors/siteleaf/siteleaf.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/skrappio/skrappio.go b/pkg/detectors/skrappio/skrappio.go index f23e90fd16a5..1ec3551004dc 100644 --- a/pkg/detectors/skrappio/skrappio.go +++ b/pkg/detectors/skrappio/skrappio.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/skybiometry/skybiometry.go b/pkg/detectors/skybiometry/skybiometry.go index 297f5a565a28..642656d44457 100644 --- a/pkg/detectors/skybiometry/skybiometry.go +++ b/pkg/detectors/skybiometry/skybiometry.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/slackwebhook/slackwebhook.go b/pkg/detectors/slackwebhook/slackwebhook.go index b038bcb13d5b..b31b6bfdf247 100644 --- a/pkg/detectors/slackwebhook/slackwebhook.go +++ b/pkg/detectors/slackwebhook/slackwebhook.go @@ -44,9 +44,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/smartsheets/smartsheets.go b/pkg/detectors/smartsheets/smartsheets.go index 0ce964465f37..b014d46d64c0 100644 --- a/pkg/detectors/smartsheets/smartsheets.go +++ b/pkg/detectors/smartsheets/smartsheets.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/smartystreets/smartystreets.go b/pkg/detectors/smartystreets/smartystreets.go index 55eb78af8a15..2526bc292334 100644 --- a/pkg/detectors/smartystreets/smartystreets.go +++ b/pkg/detectors/smartystreets/smartystreets.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) diff --git a/pkg/detectors/smooch/smooch.go b/pkg/detectors/smooch/smooch.go index 491fa7ff9a5b..0a73e1aa1284 100644 --- a/pkg/detectors/smooch/smooch.go +++ b/pkg/detectors/smooch/smooch.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/snipcart/snipcart.go b/pkg/detectors/snipcart/snipcart.go index f0e161a6ef41..0157f5d8386d 100644 --- a/pkg/detectors/snipcart/snipcart.go +++ b/pkg/detectors/snipcart/snipcart.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/snowflake/snowflake.go b/pkg/detectors/snowflake/snowflake.go index a769720d5669..224a72c7d35c 100644 --- a/pkg/detectors/snowflake/snowflake.go +++ b/pkg/detectors/snowflake/snowflake.go @@ -79,9 +79,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result passwordMatches := passwordRegexState.Matches(data) for _, accountMatch := range accountMatches { - if len(accountMatch) != 2 { - continue - } resAccountMatch := strings.TrimSpace(accountMatch[1]) for _, resUsernameMatch := range usernameMatches { diff --git a/pkg/detectors/sonarcloud/sonarcloud.go b/pkg/detectors/sonarcloud/sonarcloud.go index f7e34cbad46b..16f88bc5ff5c 100644 --- a/pkg/detectors/sonarcloud/sonarcloud.go +++ b/pkg/detectors/sonarcloud/sonarcloud.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sourcegraph/sourcegraph.go b/pkg/detectors/sourcegraph/sourcegraph.go index 08c542f6c9ac..79fbd29c1c0c 100644 --- a/pkg/detectors/sourcegraph/sourcegraph.go +++ b/pkg/detectors/sourcegraph/sourcegraph.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sourcegraphcody/sourcegraphcody.go b/pkg/detectors/sourcegraphcody/sourcegraphcody.go index 46ab53ee77ec..77c1b1219823 100644 --- a/pkg/detectors/sourcegraphcody/sourcegraphcody.go +++ b/pkg/detectors/sourcegraphcody/sourcegraphcody.go @@ -3,10 +3,11 @@ package sourcegraphcody import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sparkpost/sparkpost.go b/pkg/detectors/sparkpost/sparkpost.go index c605a4479480..eb9f4a1dea02 100644 --- a/pkg/detectors/sparkpost/sparkpost.go +++ b/pkg/detectors/sparkpost/sparkpost.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/speechtextai/speechtextai.go b/pkg/detectors/speechtextai/speechtextai.go index 0fdb0272f1c8..c3f5035740d9 100644 --- a/pkg/detectors/speechtextai/speechtextai.go +++ b/pkg/detectors/speechtextai/speechtextai.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go b/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go index 87a32b457d29..99a29a8dc090 100644 --- a/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go +++ b/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go @@ -2,10 +2,11 @@ package splunkobservabilitytoken import ( "context" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ @@ -59,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result defer res.Body.Close() if res.StatusCode >= 200 && res.StatusCode < 300 { s1.Verified = true - } + } } } diff --git a/pkg/detectors/spoonacular/spoonacular.go b/pkg/detectors/spoonacular/spoonacular.go index 6c6ec8086f24..63fd705383e8 100644 --- a/pkg/detectors/spoonacular/spoonacular.go +++ b/pkg/detectors/spoonacular/spoonacular.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sportsmonk/sportsmonk.go b/pkg/detectors/sportsmonk/sportsmonk.go index b89347e7af19..e833799f80be 100644 --- a/pkg/detectors/sportsmonk/sportsmonk.go +++ b/pkg/detectors/sportsmonk/sportsmonk.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/spotifykey/spotifykey.go b/pkg/detectors/spotifykey/spotifykey.go index c219de884d95..060abcf24528 100644 --- a/pkg/detectors/spotifykey/spotifykey.go +++ b/pkg/detectors/spotifykey/spotifykey.go @@ -42,14 +42,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } idresMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_SpotifyKey, diff --git a/pkg/detectors/square/square.go b/pkg/detectors/square/square.go index 08f840ed1092..ab00cc0b9d2c 100644 --- a/pkg/detectors/square/square.go +++ b/pkg/detectors/square/square.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secMatches := secretPat.FindAllStringSubmatch(dataStr, -1) for _, secMatch := range secMatches { - if len(secMatch) != 2 { - continue - } res := strings.TrimSpace(secMatch[1]) s := detectors.Result{ diff --git a/pkg/detectors/squarespace/squarespace.go b/pkg/detectors/squarespace/squarespace.go index 35b83f44f834..59f89a44a8e3 100644 --- a/pkg/detectors/squarespace/squarespace.go +++ b/pkg/detectors/squarespace/squarespace.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/squareup/squareup.go b/pkg/detectors/squareup/squareup.go index cb3e097ddc86..89181ff4f2ac 100644 --- a/pkg/detectors/squareup/squareup.go +++ b/pkg/detectors/squareup/squareup.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sslmate/sslmate.go b/pkg/detectors/sslmate/sslmate.go index 3dd8c6bab100..be7fd3ffc3eb 100644 --- a/pkg/detectors/sslmate/sslmate.go +++ b/pkg/detectors/sslmate/sslmate.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/statuscake/statuscake.go b/pkg/detectors/statuscake/statuscake.go index e00a2a0b6661..a3f1032bc507 100644 --- a/pkg/detectors/statuscake/statuscake.go +++ b/pkg/detectors/statuscake/statuscake.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/statuspage/statuspage.go b/pkg/detectors/statuspage/statuspage.go index 8bb04b07b48b..3e030054e261 100644 --- a/pkg/detectors/statuspage/statuspage.go +++ b/pkg/detectors/statuspage/statuspage.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/statuspal/statuspal.go b/pkg/detectors/statuspal/statuspal.go index 947a4055b56e..a2edc7ed7a99 100644 --- a/pkg/detectors/statuspal/statuspal.go +++ b/pkg/detectors/statuspal/statuspal.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stitchdata/stitchdata.go b/pkg/detectors/stitchdata/stitchdata.go index 67e7d4d357f6..6693fef4403d 100644 --- a/pkg/detectors/stitchdata/stitchdata.go +++ b/pkg/detectors/stitchdata/stitchdata.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stockdata/stockdata.go b/pkg/detectors/stockdata/stockdata.go index baef2228797d..2b1a96baf85f 100644 --- a/pkg/detectors/stockdata/stockdata.go +++ b/pkg/detectors/stockdata/stockdata.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/storecove/storecove.go b/pkg/detectors/storecove/storecove.go index 4e113e7477d3..16dd606cb590 100644 --- a/pkg/detectors/storecove/storecove.go +++ b/pkg/detectors/storecove/storecove.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stormboard/stormboard.go b/pkg/detectors/stormboard/stormboard.go index 6c2a61528e53..3944ee24a299 100644 --- a/pkg/detectors/stormboard/stormboard.go +++ b/pkg/detectors/stormboard/stormboard.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stormglass/stormglass.go b/pkg/detectors/stormglass/stormglass.go index 83216c6dbaad..5c6b644935c0 100644 --- a/pkg/detectors/stormglass/stormglass.go +++ b/pkg/detectors/stormglass/stormglass.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/storyblok/storyblok.go b/pkg/detectors/storyblok/storyblok.go index c5262d0af096..f102a3159f2c 100644 --- a/pkg/detectors/storyblok/storyblok.go +++ b/pkg/detectors/storyblok/storyblok.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/storychief/storychief.go b/pkg/detectors/storychief/storychief.go index 9e2949a975a3..7c82315d670a 100644 --- a/pkg/detectors/storychief/storychief.go +++ b/pkg/detectors/storychief/storychief.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/strava/strava.go b/pkg/detectors/strava/strava.go index 42b68d7bed3e..300ff4d069c6 100644 --- a/pkg/detectors/strava/strava.go +++ b/pkg/detectors/strava/strava.go @@ -40,21 +40,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range idMatches { - if len(match) != 2 { - continue - } resId := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKey := strings.TrimSpace(keyMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/streak/streak.go b/pkg/detectors/streak/streak.go index f241da304376..08700372a97f 100644 --- a/pkg/detectors/streak/streak.go +++ b/pkg/detectors/streak/streak.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stripo/stripo.go b/pkg/detectors/stripo/stripo.go index 73592efb7c9e..954f7d1ee879 100644 --- a/pkg/detectors/stripo/stripo.go +++ b/pkg/detectors/stripo/stripo.go @@ -35,9 +35,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/stytch/stytch.go b/pkg/detectors/stytch/stytch.go index ce8024f4f64d..30100c5683ec 100644 --- a/pkg/detectors/stytch/stytch.go +++ b/pkg/detectors/stytch/stytch.go @@ -37,15 +37,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/sugester/sugester.go b/pkg/detectors/sugester/sugester.go index 64054d152c43..1954f2445d72 100644 --- a/pkg/detectors/sugester/sugester.go +++ b/pkg/detectors/sugester/sugester.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainmatch := range domainMatches { - if len(match) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainmatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Sugester, diff --git a/pkg/detectors/sumologickey/sumologickey.go b/pkg/detectors/sumologickey/sumologickey.go index b0f6f8feedef..bbbcb84813b6 100644 --- a/pkg/detectors/sumologickey/sumologickey.go +++ b/pkg/detectors/sumologickey/sumologickey.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } resIdMatch := strings.TrimSpace(idMatch[1]) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/supabasetoken/supabasetoken.go b/pkg/detectors/supabasetoken/supabasetoken.go index 7b08cbfda74e..8ab60c3f7efe 100644 --- a/pkg/detectors/supabasetoken/supabasetoken.go +++ b/pkg/detectors/supabasetoken/supabasetoken.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/supernotesapi/supernotesapi.go b/pkg/detectors/supernotesapi/supernotesapi.go index e94f23930fc9..cf5ace250282 100644 --- a/pkg/detectors/supernotesapi/supernotesapi.go +++ b/pkg/detectors/supernotesapi/supernotesapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/surveyanyplace/surveyanyplace.go b/pkg/detectors/surveyanyplace/surveyanyplace.go index fa6c527658dc..0d53ff69dc86 100644 --- a/pkg/detectors/surveyanyplace/surveyanyplace.go +++ b/pkg/detectors/surveyanyplace/surveyanyplace.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/surveybot/surveybot.go b/pkg/detectors/surveybot/surveybot.go index e6e798bc5ef1..90697d7aefd0 100644 --- a/pkg/detectors/surveybot/surveybot.go +++ b/pkg/detectors/surveybot/surveybot.go @@ -41,9 +41,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/surveysparrow/surveysparrow.go b/pkg/detectors/surveysparrow/surveysparrow.go index 7f31317a6326..e047199b8860 100644 --- a/pkg/detectors/surveysparrow/surveysparrow.go +++ b/pkg/detectors/surveysparrow/surveysparrow.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/survicate/survicate.go b/pkg/detectors/survicate/survicate.go index c3b24d59b5a6..eeb31155cdef 100644 --- a/pkg/detectors/survicate/survicate.go +++ b/pkg/detectors/survicate/survicate.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/swell/swell.go b/pkg/detectors/swell/swell.go index c103885b29b7..39aad19a6027 100644 --- a/pkg/detectors/swell/swell.go +++ b/pkg/detectors/swell/swell.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/swiftype/swiftype.go b/pkg/detectors/swiftype/swiftype.go index bc6eba41adf9..197572b6e7c2 100644 --- a/pkg/detectors/swiftype/swiftype.go +++ b/pkg/detectors/swiftype/swiftype.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tallyfy/tallyfy.go b/pkg/detectors/tallyfy/tallyfy.go index 68f6f6cbcbfb..ff75b2d992aa 100644 --- a/pkg/detectors/tallyfy/tallyfy.go +++ b/pkg/detectors/tallyfy/tallyfy.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tatumio/tatumio.go b/pkg/detectors/tatumio/tatumio.go index 97bc9d128067..4395fab4e2ec 100644 --- a/pkg/detectors/tatumio/tatumio.go +++ b/pkg/detectors/tatumio/tatumio.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/taxjar/taxjar.go b/pkg/detectors/taxjar/taxjar.go index 956318210dec..0fa7b9e72b73 100644 --- a/pkg/detectors/taxjar/taxjar.go +++ b/pkg/detectors/taxjar/taxjar.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/teamgate/teamgate.go b/pkg/detectors/teamgate/teamgate.go index 697b8be1591c..4709b47173c6 100644 --- a/pkg/detectors/teamgate/teamgate.go +++ b/pkg/detectors/teamgate/teamgate.go @@ -37,15 +37,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result keyMatches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, keyMatch := range keyMatches { - if len(keyMatch) != 2 { - continue - } resKeyMatch := strings.TrimSpace(keyMatch[1]) diff --git a/pkg/detectors/teamworkcrm/teamworkcrm.go b/pkg/detectors/teamworkcrm/teamworkcrm.go index 3a5cae84097f..8a7d98491d02 100644 --- a/pkg/detectors/teamworkcrm/teamworkcrm.go +++ b/pkg/detectors/teamworkcrm/teamworkcrm.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/teamworkdesk/teamworkdesk.go b/pkg/detectors/teamworkdesk/teamworkdesk.go index e4e788baab87..084f0b02fd85 100644 --- a/pkg/detectors/teamworkdesk/teamworkdesk.go +++ b/pkg/detectors/teamworkdesk/teamworkdesk.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/teamworkspaces/teamworkspaces.go b/pkg/detectors/teamworkspaces/teamworkspaces.go index 3e4b3aa1c527..6e700ae1466b 100644 --- a/pkg/detectors/teamworkspaces/teamworkspaces.go +++ b/pkg/detectors/teamworkspaces/teamworkspaces.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go b/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go index fbdbda279e38..ba797d5cbb6f 100644 --- a/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go +++ b/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tefter/tefter.go b/pkg/detectors/tefter/tefter.go index 0d5dbf398710..04448256622f 100644 --- a/pkg/detectors/tefter/tefter.go +++ b/pkg/detectors/tefter/tefter.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/telegrambottoken/telegrambottoken.go b/pkg/detectors/telegrambottoken/telegrambottoken.go index 90649da1fb70..464e477f7e35 100644 --- a/pkg/detectors/telegrambottoken/telegrambottoken.go +++ b/pkg/detectors/telegrambottoken/telegrambottoken.go @@ -4,11 +4,12 @@ import ( "context" "encoding/json" - // "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + // "fmt" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -42,9 +43,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } key := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/teletype/teletype.go b/pkg/detectors/teletype/teletype.go index a56c4da6cf8d..354f20b33eb2 100644 --- a/pkg/detectors/teletype/teletype.go +++ b/pkg/detectors/teletype/teletype.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/telnyx/telnyx.go b/pkg/detectors/telnyx/telnyx.go index 4d4e11c31356..b83e0d128384 100644 --- a/pkg/detectors/telnyx/telnyx.go +++ b/pkg/detectors/telnyx/telnyx.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go b/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go index 28cddb17c341..32558b1abdbb 100644 --- a/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go +++ b/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go @@ -3,10 +3,11 @@ package terraformcloudpersonaltoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -36,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/testingbot/testingbot.go b/pkg/detectors/testingbot/testingbot.go index 9003c688e5ea..624b50a50416 100644 --- a/pkg/detectors/testingbot/testingbot.go +++ b/pkg/detectors/testingbot/testingbot.go @@ -38,14 +38,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/textmagic/textmagic.go b/pkg/detectors/textmagic/textmagic.go index bee025d95b79..91f1b727ff00 100644 --- a/pkg/detectors/textmagic/textmagic.go +++ b/pkg/detectors/textmagic/textmagic.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result userMatches := userPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, userMatch := range userMatches { - if len(match) != 2 { - continue - } resUser := strings.TrimSpace(userMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/theoddsapi/theoddsapi.go b/pkg/detectors/theoddsapi/theoddsapi.go index ca0b315cf360..2ba8a22c6530 100644 --- a/pkg/detectors/theoddsapi/theoddsapi.go +++ b/pkg/detectors/theoddsapi/theoddsapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/thinkific/thinkific.go b/pkg/detectors/thinkific/thinkific.go index 66f9459af920..04b04480679f 100644 --- a/pkg/detectors/thinkific/thinkific.go +++ b/pkg/detectors/thinkific/thinkific.go @@ -40,15 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, domainMatch := range domainMatches { - - if len(domainMatch) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Thinkific, diff --git a/pkg/detectors/thousandeyes/thousandeyes.go b/pkg/detectors/thousandeyes/thousandeyes.go index 435c858464f8..a440fa6a6085 100644 --- a/pkg/detectors/thousandeyes/thousandeyes.go +++ b/pkg/detectors/thousandeyes/thousandeyes.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emailMatches := email.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } tokenPatMatch := strings.TrimSpace(match[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(emailMatch[1]) diff --git a/pkg/detectors/ticketmaster/ticketmaster.go b/pkg/detectors/ticketmaster/ticketmaster.go index de12b7a04f76..2f5cef4e5043 100644 --- a/pkg/detectors/ticketmaster/ticketmaster.go +++ b/pkg/detectors/ticketmaster/ticketmaster.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tickettailor/tickettailor.go b/pkg/detectors/tickettailor/tickettailor.go index 10d96b551786..bf8803694815 100644 --- a/pkg/detectors/tickettailor/tickettailor.go +++ b/pkg/detectors/tickettailor/tickettailor.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tiingo/tiingo.go b/pkg/detectors/tiingo/tiingo.go index e8aa1da7e5d3..ed4bed518506 100644 --- a/pkg/detectors/tiingo/tiingo.go +++ b/pkg/detectors/tiingo/tiingo.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/timecamp/timecamp.go b/pkg/detectors/timecamp/timecamp.go index e3c132ab1d77..ba1327c0a4e1 100644 --- a/pkg/detectors/timecamp/timecamp.go +++ b/pkg/detectors/timecamp/timecamp.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/timezoneapi/timezoneapi.go b/pkg/detectors/timezoneapi/timezoneapi.go index ef7534d3a1cc..f7d691ce562e 100644 --- a/pkg/detectors/timezoneapi/timezoneapi.go +++ b/pkg/detectors/timezoneapi/timezoneapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tineswebhook/tineswebhook.go b/pkg/detectors/tineswebhook/tineswebhook.go index a5e08e9b3151..5cb15019d55c 100644 --- a/pkg/detectors/tineswebhook/tineswebhook.go +++ b/pkg/detectors/tineswebhook/tineswebhook.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tly/tly.go b/pkg/detectors/tly/tly.go index 37b7eb6ff1d0..fd7d6c40dadc 100644 --- a/pkg/detectors/tly/tly.go +++ b/pkg/detectors/tly/tly.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tmetric/tmetric.go b/pkg/detectors/tmetric/tmetric.go index 476b5e6fde33..e6174312c555 100644 --- a/pkg/detectors/tmetric/tmetric.go +++ b/pkg/detectors/tmetric/tmetric.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/todoist/todoist.go b/pkg/detectors/todoist/todoist.go index 3461c5e3bf62..a425d9e0fd5e 100644 --- a/pkg/detectors/todoist/todoist.go +++ b/pkg/detectors/todoist/todoist.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/toggltrack/toggltrack.go b/pkg/detectors/toggltrack/toggltrack.go index 883784c7bca0..8ebcb3072e8b 100644 --- a/pkg/detectors/toggltrack/toggltrack.go +++ b/pkg/detectors/toggltrack/toggltrack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tokeet/tokeet.go b/pkg/detectors/tokeet/tokeet.go index 7e7cf8668ca1..92069f3ca4cb 100644 --- a/pkg/detectors/tokeet/tokeet.go +++ b/pkg/detectors/tokeet/tokeet.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/tomorrowio/tomorrowio.go b/pkg/detectors/tomorrowio/tomorrowio.go index edf5de186032..d80744395d1e 100644 --- a/pkg/detectors/tomorrowio/tomorrowio.go +++ b/pkg/detectors/tomorrowio/tomorrowio.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tomtom/tomtom.go b/pkg/detectors/tomtom/tomtom.go index b1e1aff2c867..c0df460f5f21 100644 --- a/pkg/detectors/tomtom/tomtom.go +++ b/pkg/detectors/tomtom/tomtom.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tradier/tradier.go b/pkg/detectors/tradier/tradier.go index c11d0ee1464b..62e713d9090e 100644 --- a/pkg/detectors/tradier/tradier.go +++ b/pkg/detectors/tradier/tradier.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/transferwise/transferwise.go b/pkg/detectors/transferwise/transferwise.go index e49455d2c33d..e52acea4ffca 100644 --- a/pkg/detectors/transferwise/transferwise.go +++ b/pkg/detectors/transferwise/transferwise.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/travelpayouts/travelpayouts.go b/pkg/detectors/travelpayouts/travelpayouts.go index 6aa4b481b785..9d0a1411bd32 100644 --- a/pkg/detectors/travelpayouts/travelpayouts.go +++ b/pkg/detectors/travelpayouts/travelpayouts.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/travisci/travisci.go b/pkg/detectors/travisci/travisci.go index fe7b7a79a9d3..6909a13636af 100644 --- a/pkg/detectors/travisci/travisci.go +++ b/pkg/detectors/travisci/travisci.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/trelloapikey/trelloapikey.go b/pkg/detectors/trelloapikey/trelloapikey.go index 1f2e533fa0e2..76263c3e2230 100644 --- a/pkg/detectors/trelloapikey/trelloapikey.go +++ b/pkg/detectors/trelloapikey/trelloapikey.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if i == 0 { resMatch := strings.TrimSpace(match[1]) for _, tokenMatch := range tokenMatches { - if len(tokenMatch) != 2 { - continue - } token := strings.TrimSpace(tokenMatch[1]) diff --git a/pkg/detectors/tru/tru.go b/pkg/detectors/tru/tru.go index 2df42285c6c2..7d5d01d34752 100644 --- a/pkg/detectors/tru/tru.go +++ b/pkg/detectors/tru/tru.go @@ -40,14 +40,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result secretMatches := secrePat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, secretMatch := range secretMatches { - if len(secretMatch) != 2 { - continue - } resSecret := strings.TrimSpace(secretMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go b/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go index cc2978e1b699..1ca0bc46feaf 100644 --- a/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go +++ b/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go @@ -41,21 +41,11 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result hostnameMatches := hostnamePat.FindAllStringSubmatch(dataStr, -1) for _, keyMatch := range keyMatches { - if len(keyMatch) != 1 { - continue - } resKeyMatch := strings.TrimSpace(keyMatch[0]) for _, secretMatch := range secretMatches { - - if len(secretMatch) != 1 { - continue - } resSecretMatch := strings.TrimSpace(secretMatch[0]) for _, hostnameMatch := range hostnameMatches { - if len(hostnameMatch) != 1 { - continue - } resHostnameMatch := strings.TrimSpace(hostnameMatch[0]) diff --git a/pkg/detectors/twelvedata/twelvedata.go b/pkg/detectors/twelvedata/twelvedata.go index 1b684910d20d..625f7d67d52e 100644 --- a/pkg/detectors/twelvedata/twelvedata.go +++ b/pkg/detectors/twelvedata/twelvedata.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/twist/twist.go b/pkg/detectors/twist/twist.go index c99c423d2c30..00153cb59e7f 100644 --- a/pkg/detectors/twist/twist.go +++ b/pkg/detectors/twist/twist.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := accessToken.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) setAuth := resMatch diff --git a/pkg/detectors/twitch/twitch.go b/pkg/detectors/twitch/twitch.go index 426f89841dc7..8aaabdc944ba 100644 --- a/pkg/detectors/twitch/twitch.go +++ b/pkg/detectors/twitch/twitch.go @@ -45,15 +45,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/twitter/twitter.go b/pkg/detectors/twitter/twitter.go index a043e75176f6..39b767c0ec9b 100644 --- a/pkg/detectors/twitter/twitter.go +++ b/pkg/detectors/twitter/twitter.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/tyntec/tyntec.go b/pkg/detectors/tyntec/tyntec.go index 0269f61a1536..dfbf778d03bd 100644 --- a/pkg/detectors/tyntec/tyntec.go +++ b/pkg/detectors/tyntec/tyntec.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/typeform/typeform.go b/pkg/detectors/typeform/typeform.go index 63dfbf41e48d..114135866e39 100644 --- a/pkg/detectors/typeform/typeform.go +++ b/pkg/detectors/typeform/typeform.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/typetalk/typetalk.go b/pkg/detectors/typetalk/typetalk.go index 2ad121fe74a1..bb27ccc3474e 100644 --- a/pkg/detectors/typetalk/typetalk.go +++ b/pkg/detectors/typetalk/typetalk.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/ubidots/ubidots.go b/pkg/detectors/ubidots/ubidots.go index 303de4887197..bfea94a699f0 100644 --- a/pkg/detectors/ubidots/ubidots.go +++ b/pkg/detectors/ubidots/ubidots.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/uclassify/uclassify.go b/pkg/detectors/uclassify/uclassify.go index 29fe57cc62e0..f8f13a8f21a3 100644 --- a/pkg/detectors/uclassify/uclassify.go +++ b/pkg/detectors/uclassify/uclassify.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/unifyid/unifyid.go b/pkg/detectors/unifyid/unifyid.go index 4bb02a18056f..28aae2bd2820 100644 --- a/pkg/detectors/unifyid/unifyid.go +++ b/pkg/detectors/unifyid/unifyid.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/unplugg/unplugg.go b/pkg/detectors/unplugg/unplugg.go index 25c2b59a66f2..a228deb4c1d5 100644 --- a/pkg/detectors/unplugg/unplugg.go +++ b/pkg/detectors/unplugg/unplugg.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/unsplash/unsplash.go b/pkg/detectors/unsplash/unsplash.go index 4b2a758084b0..2ea88926350a 100644 --- a/pkg/detectors/unsplash/unsplash.go +++ b/pkg/detectors/unsplash/unsplash.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/upcdatabase/upcdatabase.go b/pkg/detectors/upcdatabase/upcdatabase.go index c18f34fe9f3f..d8d48b3c88b9 100644 --- a/pkg/detectors/upcdatabase/upcdatabase.go +++ b/pkg/detectors/upcdatabase/upcdatabase.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/uplead/uplead.go b/pkg/detectors/uplead/uplead.go index 6058835c825f..caa391223822 100644 --- a/pkg/detectors/uplead/uplead.go +++ b/pkg/detectors/uplead/uplead.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/uploadcare/uploadcare.go b/pkg/detectors/uploadcare/uploadcare.go index 6866aa75ceba..b7138954595d 100644 --- a/pkg/detectors/uploadcare/uploadcare.go +++ b/pkg/detectors/uploadcare/uploadcare.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result publicMatches := publicKeyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, publicMatch := range publicMatches { - if len(publicMatch) != 2 { - continue - } publicKeyMatch := strings.TrimSpace(publicMatch[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_UploadCare, diff --git a/pkg/detectors/uptimerobot/uptimerobot.go b/pkg/detectors/uptimerobot/uptimerobot.go index b501e246a544..36294b50abce 100644 --- a/pkg/detectors/uptimerobot/uptimerobot.go +++ b/pkg/detectors/uptimerobot/uptimerobot.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/upwave/upwave.go b/pkg/detectors/upwave/upwave.go index c42178d0b84c..86eba28c4639 100644 --- a/pkg/detectors/upwave/upwave.go +++ b/pkg/detectors/upwave/upwave.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/urlscan/urlscan.go b/pkg/detectors/urlscan/urlscan.go index b1236f8708c5..906c4be0cbe8 100644 --- a/pkg/detectors/urlscan/urlscan.go +++ b/pkg/detectors/urlscan/urlscan.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/user/user.go b/pkg/detectors/user/user.go index ee5ec0fa2c87..7d0f80ee9838 100644 --- a/pkg/detectors/user/user.go +++ b/pkg/detectors/user/user.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/userflow/userflow.go b/pkg/detectors/userflow/userflow.go index 9014b5f5e589..9e4ca92b328c 100644 --- a/pkg/detectors/userflow/userflow.go +++ b/pkg/detectors/userflow/userflow.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/userstack/userstack.go b/pkg/detectors/userstack/userstack.go index 7655a8e805df..e7b65ec0c9e4 100644 --- a/pkg/detectors/userstack/userstack.go +++ b/pkg/detectors/userstack/userstack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go b/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go index 9515301151f3..a2e4f3f16240 100644 --- a/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go +++ b/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go @@ -3,10 +3,11 @@ package vagrantcloudpersonaltoken import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -38,9 +39,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vatlayer/vatlayer.go b/pkg/detectors/vatlayer/vatlayer.go index 6951bdf0f889..4dbc2081900a 100644 --- a/pkg/detectors/vatlayer/vatlayer.go +++ b/pkg/detectors/vatlayer/vatlayer.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vbout/vbout.go b/pkg/detectors/vbout/vbout.go index e8badadc7be3..40cf8560840e 100644 --- a/pkg/detectors/vbout/vbout.go +++ b/pkg/detectors/vbout/vbout.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vercel/vercel.go b/pkg/detectors/vercel/vercel.go index 4b04286b5a68..66001b19f988 100644 --- a/pkg/detectors/vercel/vercel.go +++ b/pkg/detectors/vercel/vercel.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/verifier/verifier.go b/pkg/detectors/verifier/verifier.go index 5bea79f9bfad..fe05f66be84f 100644 --- a/pkg/detectors/verifier/verifier.go +++ b/pkg/detectors/verifier/verifier.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := emailPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - if len(idMatch) != 2 { - continue - } userPatMatch := strings.TrimSpace(idMatch[1]) diff --git a/pkg/detectors/verimail/verimail.go b/pkg/detectors/verimail/verimail.go index ce90672e9a44..eb9cf4a1ec2e 100644 --- a/pkg/detectors/verimail/verimail.go +++ b/pkg/detectors/verimail/verimail.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/veriphone/veriphone.go b/pkg/detectors/veriphone/veriphone.go index 16cfb0eabc0a..2cf37652a30d 100644 --- a/pkg/detectors/veriphone/veriphone.go +++ b/pkg/detectors/veriphone/veriphone.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/versioneye/versioneye.go b/pkg/detectors/versioneye/versioneye.go index 74c718f11e0b..9e497d57d7df 100644 --- a/pkg/detectors/versioneye/versioneye.go +++ b/pkg/detectors/versioneye/versioneye.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/viewneo/viewneo.go b/pkg/detectors/viewneo/viewneo.go index d12fffc693c9..6fa03c1b2158 100644 --- a/pkg/detectors/viewneo/viewneo.go +++ b/pkg/detectors/viewneo/viewneo.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/virustotal/virustotal.go b/pkg/detectors/virustotal/virustotal.go index db78d8a5661a..baaa4603eaa0 100644 --- a/pkg/detectors/virustotal/virustotal.go +++ b/pkg/detectors/virustotal/virustotal.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/visualcrossing/visualcrossing.go b/pkg/detectors/visualcrossing/visualcrossing.go index 81fb62ff00ea..37a5064a42ff 100644 --- a/pkg/detectors/visualcrossing/visualcrossing.go +++ b/pkg/detectors/visualcrossing/visualcrossing.go @@ -3,10 +3,11 @@ package visualcrossing import ( "context" "fmt" - regexp "github.com/wasilibs/go-re2" "net/http" "strings" + regexp "github.com/wasilibs/go-re2" + "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb" @@ -37,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/voiceflow/voiceflow.go b/pkg/detectors/voiceflow/voiceflow.go index 1ffb1b11d263..a3a3cd613d8c 100644 --- a/pkg/detectors/voiceflow/voiceflow.go +++ b/pkg/detectors/voiceflow/voiceflow.go @@ -42,9 +42,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/voicegain/voicegain.go b/pkg/detectors/voicegain/voicegain.go index e118b51e3249..98043d0e855f 100644 --- a/pkg/detectors/voicegain/voicegain.go +++ b/pkg/detectors/voicegain/voicegain.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/voodoosms/voodoosms.go b/pkg/detectors/voodoosms/voodoosms.go index 8490d00319cd..0912c26f9268 100644 --- a/pkg/detectors/voodoosms/voodoosms.go +++ b/pkg/detectors/voodoosms/voodoosms.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vouchery/vouchery.go b/pkg/detectors/vouchery/vouchery.go index 2f5d5d296510..48d182832a51 100644 --- a/pkg/detectors/vouchery/vouchery.go +++ b/pkg/detectors/vouchery/vouchery.go @@ -39,15 +39,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result subMatches := subPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, subMatch := range subMatches { - if len(subMatch) != 2 { - continue - } subMatch := strings.TrimSpace(subMatch[1]) diff --git a/pkg/detectors/vpnapi/vpnapi.go b/pkg/detectors/vpnapi/vpnapi.go index a53ec3eecfd1..847a8662a9d1 100644 --- a/pkg/detectors/vpnapi/vpnapi.go +++ b/pkg/detectors/vpnapi/vpnapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vultrapikey/vultrapikey.go b/pkg/detectors/vultrapikey/vultrapikey.go index 96029c911902..c4c43f663796 100644 --- a/pkg/detectors/vultrapikey/vultrapikey.go +++ b/pkg/detectors/vultrapikey/vultrapikey.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/vyte/vyte.go b/pkg/detectors/vyte/vyte.go index 653e29c2a28c..eb7fd026be22 100644 --- a/pkg/detectors/vyte/vyte.go +++ b/pkg/detectors/vyte/vyte.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/walkscore/walkscore.go b/pkg/detectors/walkscore/walkscore.go index b3d87654f284..2d046e62f0ac 100644 --- a/pkg/detectors/walkscore/walkscore.go +++ b/pkg/detectors/walkscore/walkscore.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/weatherbit/weatherbit.go b/pkg/detectors/weatherbit/weatherbit.go index fbc752cf5005..fb7a98647423 100644 --- a/pkg/detectors/weatherbit/weatherbit.go +++ b/pkg/detectors/weatherbit/weatherbit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/weatherstack/weatherstack.go b/pkg/detectors/weatherstack/weatherstack.go index 234d931e4146..b5d58fcb319b 100644 --- a/pkg/detectors/weatherstack/weatherstack.go +++ b/pkg/detectors/weatherstack/weatherstack.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/web3storage/web3storage.go b/pkg/detectors/web3storage/web3storage.go index 3510f0a92697..533f1e344eca 100644 --- a/pkg/detectors/web3storage/web3storage.go +++ b/pkg/detectors/web3storage/web3storage.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/webex/webex.go b/pkg/detectors/webex/webex.go index fbeecb03ef31..1764658b4df4 100644 --- a/pkg/detectors/webex/webex.go +++ b/pkg/detectors/webex/webex.go @@ -37,15 +37,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idMatches := idPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { - - if len(idMatch) != 2 { - continue - } id := strings.TrimSpace(idMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/webflow/webflow.go b/pkg/detectors/webflow/webflow.go index b1f69d182285..df170be55bf0 100644 --- a/pkg/detectors/webflow/webflow.go +++ b/pkg/detectors/webflow/webflow.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/webscraper/webscraper.go b/pkg/detectors/webscraper/webscraper.go index 963e3799af35..caec385f80cd 100644 --- a/pkg/detectors/webscraper/webscraper.go +++ b/pkg/detectors/webscraper/webscraper.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/webscraping/webscraping.go b/pkg/detectors/webscraping/webscraping.go index acbb46de9b38..0d8e7186ee73 100644 --- a/pkg/detectors/webscraping/webscraping.go +++ b/pkg/detectors/webscraping/webscraping.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/websitepulse/websitepulse.go b/pkg/detectors/websitepulse/websitepulse.go index 37bd03ba8deb..243a6f43895f 100644 --- a/pkg/detectors/websitepulse/websitepulse.go +++ b/pkg/detectors/websitepulse/websitepulse.go @@ -40,15 +40,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_Websitepulse, diff --git a/pkg/detectors/wepay/wepay.go b/pkg/detectors/wepay/wepay.go index 6e3391c4c632..6b79f652b1b7 100644 --- a/pkg/detectors/wepay/wepay.go +++ b/pkg/detectors/wepay/wepay.go @@ -40,17 +40,11 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resAppIDMatch := "" for _, appIDMatch := range appIDmatches { - if len(appIDMatch) != 2 { - continue - } resAppIDMatch = strings.TrimSpace(appIDMatch[1]) } for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ DetectorType: detectorspb.DetectorType_WePay, diff --git a/pkg/detectors/whoxy/whoxy.go b/pkg/detectors/whoxy/whoxy.go index 4405a299e032..33a52aea0a95 100644 --- a/pkg/detectors/whoxy/whoxy.go +++ b/pkg/detectors/whoxy/whoxy.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/wistia/wistia.go b/pkg/detectors/wistia/wistia.go index 9efc215a1f5a..fd2537f10a6e 100644 --- a/pkg/detectors/wistia/wistia.go +++ b/pkg/detectors/wistia/wistia.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/wit/wit.go b/pkg/detectors/wit/wit.go index 7f77a2ccb02e..52abdbf83d53 100644 --- a/pkg/detectors/wit/wit.go +++ b/pkg/detectors/wit/wit.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/worksnaps/worksnaps.go b/pkg/detectors/worksnaps/worksnaps.go index a8c9872670c8..a9355b7988ed 100644 --- a/pkg/detectors/worksnaps/worksnaps.go +++ b/pkg/detectors/worksnaps/worksnaps.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/workstack/workstack.go b/pkg/detectors/workstack/workstack.go index fb076f84f19c..e3a6c2555062 100644 --- a/pkg/detectors/workstack/workstack.go +++ b/pkg/detectors/workstack/workstack.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/worldcoinindex/worldcoinindex.go b/pkg/detectors/worldcoinindex/worldcoinindex.go index 287f9aa88396..8e4cd9ad1164 100644 --- a/pkg/detectors/worldcoinindex/worldcoinindex.go +++ b/pkg/detectors/worldcoinindex/worldcoinindex.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/worldweather/worldweather.go b/pkg/detectors/worldweather/worldweather.go index 296cb7b78b8a..01d4a56f2ca5 100644 --- a/pkg/detectors/worldweather/worldweather.go +++ b/pkg/detectors/worldweather/worldweather.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/wrike/wrike.go b/pkg/detectors/wrike/wrike.go index de45cd446e99..4affefcdf7cf 100644 --- a/pkg/detectors/wrike/wrike.go +++ b/pkg/detectors/wrike/wrike.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/yandex/yandex.go b/pkg/detectors/yandex/yandex.go index 93603818d63b..fb6e0829a42e 100644 --- a/pkg/detectors/yandex/yandex.go +++ b/pkg/detectors/yandex/yandex.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/yelp/yelp.go b/pkg/detectors/yelp/yelp.go index 58019f4aaec3..13674557527a 100644 --- a/pkg/detectors/yelp/yelp.go +++ b/pkg/detectors/yelp/yelp.go @@ -40,9 +40,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/youneedabudget/youneedabudget.go b/pkg/detectors/youneedabudget/youneedabudget.go index 48e56c4a42d8..785d2f73d41d 100644 --- a/pkg/detectors/youneedabudget/youneedabudget.go +++ b/pkg/detectors/youneedabudget/youneedabudget.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/yousign/yousign.go b/pkg/detectors/yousign/yousign.go index b187879eaff7..c476e38a22ce 100644 --- a/pkg/detectors/yousign/yousign.go +++ b/pkg/detectors/yousign/yousign.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/youtubeapikey/youtubeapikey.go b/pkg/detectors/youtubeapikey/youtubeapikey.go index e77ac9201fab..56fbf51c84c6 100644 --- a/pkg/detectors/youtubeapikey/youtubeapikey.go +++ b/pkg/detectors/youtubeapikey/youtubeapikey.go @@ -38,15 +38,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result idmatches := idPat.FindAllStringSubmatch(dataStr, -1) 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]) s1 := detectors.Result{ diff --git a/pkg/detectors/zapierwebhook/zapierwebhook.go b/pkg/detectors/zapierwebhook/zapierwebhook.go index 9f1d45ffe8fb..e4ff7a22b242 100644 --- a/pkg/detectors/zapierwebhook/zapierwebhook.go +++ b/pkg/detectors/zapierwebhook/zapierwebhook.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zendeskapi/zendeskapi.go b/pkg/detectors/zendeskapi/zendeskapi.go index 1c0043a9eb9a..4ca2c896f94e 100644 --- a/pkg/detectors/zendeskapi/zendeskapi.go +++ b/pkg/detectors/zendeskapi/zendeskapi.go @@ -41,22 +41,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result emails := email.FindAllStringSubmatch(dataStr, -1) for _, token := range tokens { - if len(token) != 2 { - continue - } resMatch := strings.TrimSpace(token[1]) var resDomain string for _, domain := range domains { - if len(domain) != 2 { - continue - } resDomain = strings.TrimSpace(domain[1]) for _, email := range emails { - if len(email) != 2 { - continue - } resEmail := strings.TrimSpace(email[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zenkitapi/zenkitapi.go b/pkg/detectors/zenkitapi/zenkitapi.go index d17a636c5dca..d7c23cc4ffba 100644 --- a/pkg/detectors/zenkitapi/zenkitapi.go +++ b/pkg/detectors/zenkitapi/zenkitapi.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zenrows/zenrows.go b/pkg/detectors/zenrows/zenrows.go index 5f85f5871d9c..62097a1d6de8 100644 --- a/pkg/detectors/zenrows/zenrows.go +++ b/pkg/detectors/zenrows/zenrows.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zenscrape/zenscrape.go b/pkg/detectors/zenscrape/zenscrape.go index 05d0fb2294bc..aa990f873c83 100644 --- a/pkg/detectors/zenscrape/zenscrape.go +++ b/pkg/detectors/zenscrape/zenscrape.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zenserp/zenserp.go b/pkg/detectors/zenserp/zenserp.go index 84375a5e4c19..520dd73fecae 100644 --- a/pkg/detectors/zenserp/zenserp.go +++ b/pkg/detectors/zenserp/zenserp.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zeplin/zeplin.go b/pkg/detectors/zeplin/zeplin.go index bd3eb38b1b23..f8d9cfb57e98 100644 --- a/pkg/detectors/zeplin/zeplin.go +++ b/pkg/detectors/zeplin/zeplin.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zerobounce/zerobounce.go b/pkg/detectors/zerobounce/zerobounce.go index 23dbd37a1355..07f279b2e8d1 100644 --- a/pkg/detectors/zerobounce/zerobounce.go +++ b/pkg/detectors/zerobounce/zerobounce.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zerotier/zerotier.go b/pkg/detectors/zerotier/zerotier.go index 03433ed2d430..7d70b3065ffa 100644 --- a/pkg/detectors/zerotier/zerotier.go +++ b/pkg/detectors/zerotier/zerotier.go @@ -38,9 +38,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zipapi/zipapi.go b/pkg/detectors/zipapi/zipapi.go index 8f544a080dc5..be8433270eb7 100644 --- a/pkg/detectors/zipapi/zipapi.go +++ b/pkg/detectors/zipapi/zipapi.go @@ -42,19 +42,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result pwordMatches := pwordPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, emailMatch := range emailMatches { - if len(emailMatch) != 2 { - continue - } resEmail := strings.TrimSpace(emailMatch[1]) for _, pwordMatch := range pwordMatches { - if len(pwordMatch) != 2 { - continue - } resPword := strings.TrimSpace(pwordMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zipbooks/zipbooks.go b/pkg/detectors/zipbooks/zipbooks.go index 28ada1847dcd..b6fd5be51127 100644 --- a/pkg/detectors/zipbooks/zipbooks.go +++ b/pkg/detectors/zipbooks/zipbooks.go @@ -39,14 +39,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result pwordMatches := pwordPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, pwordMatch := range pwordMatches { - if len(pwordMatch) != 2 { - continue - } resPword := strings.TrimSpace(pwordMatch[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zipcodeapi/zipcodeapi.go b/pkg/detectors/zipcodeapi/zipcodeapi.go index f0f47802eddf..3c0baa180495 100644 --- a/pkg/detectors/zipcodeapi/zipcodeapi.go +++ b/pkg/detectors/zipcodeapi/zipcodeapi.go @@ -37,9 +37,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zipcodebase/zipcodebase.go b/pkg/detectors/zipcodebase/zipcodebase.go index 3aea7b32b5a3..f995233e0788 100644 --- a/pkg/detectors/zipcodebase/zipcodebase.go +++ b/pkg/detectors/zipcodebase/zipcodebase.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zonkafeedback/zonkafeedback.go b/pkg/detectors/zonkafeedback/zonkafeedback.go index 1379656d0526..863d46240b56 100644 --- a/pkg/detectors/zonkafeedback/zonkafeedback.go +++ b/pkg/detectors/zonkafeedback/zonkafeedback.go @@ -36,9 +36,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result matches := keyPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) s1 := detectors.Result{ diff --git a/pkg/detectors/zulipchat/zulipchat.go b/pkg/detectors/zulipchat/zulipchat.go index 61c70f3d3b66..d58943d207c8 100644 --- a/pkg/detectors/zulipchat/zulipchat.go +++ b/pkg/detectors/zulipchat/zulipchat.go @@ -43,9 +43,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result domainMatches := domainPat.FindAllStringSubmatch(dataStr, -1) for _, match := range matches { - if len(match) != 2 { - continue - } resMatch := strings.TrimSpace(match[1]) for _, idMatch := range idMatches { @@ -53,9 +50,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result resIdMatch := strings.TrimSpace(idMatch[1]) for _, domainMatch := range domainMatches { - if len(domainMatch) != 2 { - continue - } resDomainMatch := strings.TrimSpace(domainMatch[1])