Skip to content

Commit

Permalink
Remove detectors.IsKnownFalsePositive from detectors
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin-decker committed Mar 29, 2024
1 parent 7620906 commit e58f065
Show file tree
Hide file tree
Showing 791 changed files with 88 additions and 4,070 deletions.
5 changes: 0 additions & 5 deletions pkg/detectors/abbysale/abbysale.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/abstract/abstract.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/abuseipdb/abuseipdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/accuweather/accuweather.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/adafruitio/adafruitio.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/adobeio/adobeio.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/adzuna/adzuna.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/detectors/aeroworkflow/aeroworkflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
results = append(results, s1)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/agora/agora.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/aha/aha.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}

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 @@ -76,12 +76,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
}

if !s1.Verified {
if detectors.IsKnownFalsePositive(string(s1.Raw), detectors.DefaultFalsePositives, true) {
continue
}
}

results = append(results, s1)

}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/airbrakeuserkey/airbrakeuserkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/airship/airship.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/detectors/airtableapikey/airtableapikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.Verified = true
}
}
} else {
if detectors.IsKnownFalsePositive(keyRes, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/airvisual/airvisual.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/aiven/aiven.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/alchemy/alchemy.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, match)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(match, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/alconost/alconost.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions pkg/detectors/alegra/alegra.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package alegra

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 @@ -67,11 +68,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(tokenPatMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions pkg/detectors/aletheiaapi/aletheiaapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package aletheiaapi

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"
Expand Down Expand Up @@ -60,11 +61,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/algoliaadminkey/algoliaadminkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/detectors/alibaba/alibaba.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
s1.SetVerificationError(verificationErr, resMatch)
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
results = append(results, s1)
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/alienvault/alienvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions pkg/detectors/allsports/allsports.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"io"
"net/http"
// "log"
regexp "github.com/wasilibs/go-re2"
"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 @@ -64,10 +64,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result

if strings.Contains(body, "success") {
s1.Verified = true
} else {
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/amadeus/amadeus.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
body := string(bodyBytes)
if (res.StatusCode >= 200 && res.StatusCode < 300) && strings.Contains(body, "access_token") {
s1.Verified = true
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/ambee/ambee.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/amplitudeapikey/amplitudeapikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/anthropic/anthropic.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
}

// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if !s1.Verified && detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}

results = append(results, s1)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/anypoint/anypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/detectors/apacta/apacta.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ 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
} else {
// This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key.
if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) {
continue
}
}
}
}
Expand Down
Loading

0 comments on commit e58f065

Please sign in to comment.