Skip to content

Commit

Permalink
chore(detectors): remove match len check
Browse files Browse the repository at this point in the history
  • Loading branch information
rgmz authored and Richard Gomez committed May 22, 2024
1 parent b9ea2f5 commit f2c38e0
Show file tree
Hide file tree
Showing 772 changed files with 109 additions and 2,967 deletions.
3 changes: 0 additions & 3 deletions pkg/detectors/abbysale/abbysale.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/abstract/abstract.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/abuseipdb/abuseipdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/accuweather/accuweather.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/adafruitio/adafruitio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
9 changes: 2 additions & 7 deletions pkg/detectors/adobeio/adobeio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{
Expand Down
9 changes: 2 additions & 7 deletions pkg/detectors/adzuna/adzuna.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/detectors/aeroworkflow/aeroworkflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/detectors/agora/agora.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/detectors/aha/aha.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/airbrakeuserkey/airbrakeuserkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/airship/airship.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/detectors/airtableapikey/airtableapikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/airvisual/airvisual.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/aiven/aiven.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/alconost/alconost.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/detectors/alegra/alegra.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/aletheiaapi/aletheiaapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/detectors/algoliaadminkey/algoliaadminkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/detectors/alibaba/alibaba.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/alienvault/alienvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/allsports/allsports.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
9 changes: 2 additions & 7 deletions pkg/detectors/amadeus/amadeus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/ambee/ambee.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/detectors/amplitudeapikey/amplitudeapikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions pkg/detectors/anthropic/anthropic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit f2c38e0

Please sign in to comment.