Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
[chore] - fix test (#1383)
ahravce4a1fd7e691
diff --git a/pkg/detectors/kanbantool/kanbantool_test.go b/pkg/detectors/kanbantool/kanbantool_test.goindex 6a15bed91..2214b9ea2 100644--- a/pkg/detectors/kanbantool/kanbantool_test.go+++ b/pkg/detectors/kanbantool/kanbantool_test.go@@ -7,9 +7,9 @@ import ("time""github.com/kylelemons/godebug/pretty"- "github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/common"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb")@@ -41,7 +41,7 @@ func TestKanbantool_FromChunk(t *testing.T) {s: Scanner{},args: args{ctx: context.Background(),- data: []byte(fmt.Sprintf("You can find a kanbantool secret %s within kanbantool %s", secret,domain)),+ data: []byte(fmt.Sprintf("You can find a kanbantool secret %s within kanbantool %s", secret, domain)),verify: true,},want: []detectors.Result{@@ -57,7 +57,7 @@ func TestKanbantool_FromChunk(t *testing.T) {s: Scanner{},args: args{ctx: context.Background(),- data: []byte(fmt.Sprintf("You can find a kanbantool secret %s within but not valid kanbantool %s", inactiveSecret,domain)), // the secret would satisfy the regex but not pass validation+ data: []byte(fmt.Sprintf("You can find a kanbantool secret %s within but not valid kanbantool %s", inactiveSecret, domain)), // the secret would satisfy the regex but not pass validationverify: true,},want: []detectors.Result{@@ -93,10 +93,12 @@ func TestKanbantool_FromChunk(t *testing.T) {t.Fatalf("no raw secret present: \n %+v", got[i])}got[i].Raw = nil++ if diff := pretty.Compare(got[i], tt.want[0]); diff != "" {+ t.Errorf("Kanbantool.FromData() %s diff: (-got +want)\n%s", tt.name, diff)+ }}- if diff := pretty.Compare(got, tt.want); diff != "" {- t.Errorf("Kanbantool.FromData() %s diff: (-got +want)\n%s", tt.name, diff)- }+})}}diff --git a/pkg/detectors/twilio/twilio.go b/pkg/detectors/twilio/twilio.goindex ecd5b54f8..5d9b4f564 100644--- a/pkg/detectors/twilio/twilio.go+++ b/pkg/detectors/twilio/twilio.go@@ -43,7 +43,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultsidMatches := sidPat.FindAllString(dataStr, -1)for _, sid := range sidMatches {-s := detectors.Result{DetectorType: detectorspb.DetectorType_Twilio,Raw: []byte(sid),diff --git a/pkg/detectors/twilio/twilio_test.go b/pkg/detectors/twilio/twilio_test.goindex 7a7b28d9d..28db190b1 100644--- a/pkg/detectors/twilio/twilio_test.go+++ b/pkg/detectors/twilio/twilio_test.go@@ -10,6 +10,7 @@ import ("time""github.com/kylelemons/godebug/pretty"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb"@@ -18,7 +19,7 @@ import (func TestTwilio_FromChunk(t *testing.T) {ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)defer cancel()- testSecrets, err := common.GetSecret(ctx, "trufflehog-testing", "detectors2")+ testSecrets, err := common.GetSecret(ctx, "trufflehog-testing", "detectors4")if err != nil {t.Fatalf("could not get test secrets from GCP: %s", err)}