Skip to content

Find, verify, and analyze leaked credentials

[Fix] Fix Abyssale Detector Typo (#4067)

Nabeel Alamd05884722cd2
diff --git a/pkg/detectors/abbysale/abbysale.go b/pkg/detectors/abyssale/abyssale.go
similarity index 74%
rename from pkg/detectors/abbysale/abbysale.go
rename to pkg/detectors/abyssale/abyssale.go
index d9db9d2a4..8e2e602ff 100644
--- a/pkg/detectors/abbysale/abbysale.go
+++ b/pkg/detectors/abyssale/abyssale.go
@@ -1,4 +1,4 @@
-package abbysale
+package abyssale
import (
"context"
@@ -17,7 +17,7 @@ type Scanner struct {
client *http.Client
}
-const abbysaleURL = "https://api.abyssale.com"
+const abyssaleURL = "https://api.abyssale.com"
var (
// Ensure the Scanner satisfies the interface at compile time.
@@ -26,13 +26,13 @@ var (
defaultClient = common.SaneHttpClient()
// Make sure that your group is surrounded in boundary characters such as below to reduce false positives.
- keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"abbysale"}) + `\b([a-z0-9A-Z]{40})\b`)
+ keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"abyssale"}) + `\b([a-z0-9A-Z]{40})\b`)
)
// Keywords are used for efficiently pre-filtering chunks.
// Use identifiers in the secret preferably, or the provider name.
func (s Scanner) Keywords() []string {
- return []string{"abbysale"}
+ return []string{"abyssale"}
}
func (s Scanner) getClient() *http.Client {
@@ -42,7 +42,7 @@ func (s Scanner) getClient() *http.Client {
return defaultClient
}
-// FromData will find and optionally verify Abbysale secrets in a given set of bytes.
+// FromData will find and optionally verify Abyssale secrets in a given set of bytes.
func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (results []detectors.Result, err error) {
dataStr := string(data)
@@ -52,13 +52,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
resMatch := strings.TrimSpace(match[1])
s1 := detectors.Result{
- DetectorType: detectorspb.DetectorType_Abbysale,
+ DetectorType: detectorspb.DetectorType_Abyssale,
Raw: []byte(resMatch),
}
if verify {
client := s.getClient()
- isVerified, verificationErr := verifyAbbysale(ctx, client, resMatch)
+ isVerified, verificationErr := verifyAbyssale(ctx, client, resMatch)
s1.Verified = isVerified
s1.SetVerificationError(verificationErr, resMatch)
}
@@ -69,9 +69,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
return results, nil
}
-func verifyAbbysale(ctx context.Context, client *http.Client, resMatch string) (bool, error) {
+func verifyAbyssale(ctx context.Context, client *http.Client, resMatch string) (bool, error) {
// https://developers.abyssale.com/rest-api/authentication
- req, err := http.NewRequestWithContext(ctx, http.MethodGet, abbysaleURL+"/ready", nil)
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, abyssaleURL+"/ready", nil)
if err != nil {
return false, err
}
@@ -93,9 +93,9 @@ func verifyAbbysale(ctx context.Context, client *http.Client, resMatch string) (
}
func (s Scanner) Type() detectorspb.DetectorType {
- return detectorspb.DetectorType_Abbysale
+ return detectorspb.DetectorType_Abyssale
}
func (s Scanner) Description() string {
- return "Abbysale is a service offering various API functionalities for marketing automation and services such as images and ad campaigns. Abbysale API keys can be used to access and interact with this data."
+ return "Abyssale is a service offering various API functionalities for marketing automation and services such as images and ad campaigns. Abyssale API keys can be used to access and interact with this data."
}
diff --git a/pkg/detectors/abbysale/abbysale_integration_test.go b/pkg/detectors/abyssale/abyssale_integration_test.go
similarity index 82%
rename from pkg/detectors/abbysale/abbysale_integration_test.go
rename to pkg/detectors/abyssale/abyssale_integration_test.go
index 665ce0b81..bcbf0d35e 100644
--- a/pkg/detectors/abbysale/abbysale_integration_test.go
+++ b/pkg/detectors/abyssale/abyssale_integration_test.go
@@ -1,31 +1,32 @@
//go:build detectors
// +build detectors
-package abbysale
+package abyssale
import (
"context"
"fmt"
+ "testing"
+ "time"
+
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/trufflesecurity/trufflehog/v3/pkg/common"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb"
- "testing"
- "time"
"github.com/google/go-cmp/cmp"
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
)
-func TestAbbysale_FromChunk(t *testing.T) {
+func TestAbyssale_FromChunk(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
- testSecrets, err := common.GetSecret(ctx, "trufflehog-testing", "detectors3")
+ testSecrets, err := common.GetSecret(ctx, "trufflehog-testing", "detectors5")
if err != nil {
t.Fatalf("could not get test secrets from GCP: %s", err)
}
- secret := testSecrets.MustGetField("ABBYSALE_TOKEN")
- inactiveSecret := testSecrets.MustGetField("ABBYSALE_INACTIVE")
+ secret := testSecrets.MustGetField("ABYSSALE_TOKEN")
+ inactiveSecret := testSecrets.MustGetField("ABYSSALE_INACTIVE")
type args struct {
ctx context.Context
@@ -44,12 +45,12 @@ func TestAbbysale_FromChunk(t *testing.T) {
s: Scanner{},
args: args{
ctx: context.Background(),
- data: []byte(fmt.Sprintf("You can find a abbysale secret %s within but verified", secret)),
+ data: []byte(fmt.Sprintf("You can find a abyssale secret %s within but verified", secret)),
verify: true,
},
want: []detectors.Result{
{
- DetectorType: detectorspb.DetectorType_Abbysale,
+ DetectorType: detectorspb.DetectorType_Abyssale,
Verified: true,
},
},
@@ -60,12 +61,12 @@ func TestAbbysale_FromChunk(t *testing.T) {
s: Scanner{client: common.SaneHttpClientTimeOut(1 * time.Microsecond)},
args: args{
ctx: context.Background(),
- data: []byte(fmt.Sprintf("You can find a abbysale secret %s within but verified", secret)),
+ data: []byte(fmt.Sprintf("You can find a abyssale secret %s within but verified", secret)),
verify: true,
},
want: func() []detectors.Result {
r := detectors.Result{
- DetectorType: detectorspb.DetectorType_Abbysale,
+ DetectorType: detectorspb.DetectorType_Abyssale,
Verified: false,
}
r.SetVerificationError(context.DeadlineExceeded)
@@ -78,12 +79,12 @@ func TestAbbysale_FromChunk(t *testing.T) {
s: Scanner{client: common.ConstantResponseHttpClient(500, "{}")},
args: args{
ctx: context.Background(),
- data: []byte(fmt.Sprintf("You can find a abbysale secret %s within but verified", secret)),
+ data: []byte(fmt.Sprintf("You can find a abyssale secret %s within but verified", secret)),
verify: true,
},
want: func() []detectors.Result {
r := detectors.Result{
- DetectorType: detectorspb.DetectorType_Abbysale,
+ DetectorType: detectorspb.DetectorType_Abyssale,
Verified: false,
}
r.SetVerificationError(fmt.Errorf("unexpected HTTP response status 500"))
@@ -96,12 +97,12 @@ func TestAbbysale_FromChunk(t *testing.T) {
s: Scanner{},
args: args{
ctx: context.Background(),
- data: []byte(fmt.Sprintf("You can find a abbysale secret %s within but verified", inactiveSecret)), // the secret would satisfy the regex but not pass validation
+ data: []byte(fmt.Sprintf("You can find a abyssale secret %s within but verified", inactiveSecret)), // the secret would satisfy the regex but not pass validation
verify: true,
},
want: []detectors.Result{
{
- DetectorType: detectorspb.DetectorType_Abbysale,
+ DetectorType: detectorspb.DetectorType_Abyssale,
Verified: false,
},
},
@@ -123,7 +124,7 @@ func TestAbbysale_FromChunk(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
got, err := tt.s.FromData(tt.args.ctx, tt.args.verify, tt.args.data)
if (err != nil) != tt.wantErr {
- t.Errorf("Abbysale.FromData() error = %v, wantErr %v", err, tt.wantErr)
+ t.Errorf("Abyssale.FromData() error = %v, wantErr %v", err, tt.wantErr)
return
}
for i := range got {
@@ -145,7 +146,7 @@ func TestAbbysale_FromChunk(t *testing.T) {
}
ignoreOpts := cmpopts.IgnoreFields(detectors.Result{}, "Raw", "RawV2", "verificationError")
if diff := cmp.Diff(got, tt.want, ignoreOpts); diff != "" {
- t.Errorf("Abbysale.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
+ t.Errorf("Abyssale.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
}
})
}
diff --git a/pkg/detectors/abbysale/abbysale_test.go b/pkg/detectors/abyssale/abyssale_test.go
similarity index 88%
rename from pkg/detectors/abbysale/abbysale_test.go
rename to pkg/detectors/abyssale/abyssale_test.go
index 329a3eca0..3016149c7 100644
--- a/pkg/detectors/abbysale/abbysale_test.go
+++ b/pkg/detectors/abyssale/abyssale_test.go
@@ -1,4 +1,4 @@
-package abbysale
+package abyssale
import (
"context"
@@ -16,7 +16,7 @@ var (
invalidPattern = "123abcDEF456ghiJKL789mnoPQR012stuVWX"
)
-func TestAbbySale_Pattern(t *testing.T) {
+func TestAbyssale_Pattern(t *testing.T) {
d := Scanner{}
ahoCorasickCore := ahocorasick.NewAhoCorasickCore([]detectors.Detector{d})
@@ -27,17 +27,17 @@ func TestAbbySale_Pattern(t *testing.T) {
}{
{
name: "valid pattern",
- input: fmt.Sprintf("abbysale token = '%s'", validPattern),
+ input: fmt.Sprintf("abyssale token = '%s'", validPattern),
want: []string{validPattern},
},
{
name: "valid pattern - out of prefix range",
- input: fmt.Sprintf("abbysale token keyword is not close to the real token = '%s'", validPattern),
+ input: fmt.Sprintf("abyssale token keyword is not close to the real token = '%s'", validPattern),
want: nil,
},
{
name: "invalid pattern",
- input: fmt.Sprintf("abbysale = '%s'", invalidPattern),
+ input: fmt.Sprintf("abyssale = '%s'", invalidPattern),
want: nil,
},
}
diff --git a/pkg/engine/defaults/defaults.go b/pkg/engine/defaults/defaults.go
index f987fd8f0..f28c9be41 100644
--- a/pkg/engine/defaults/defaults.go
+++ b/pkg/engine/defaults/defaults.go
@@ -2,8 +2,8 @@ package defaults
import (
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
- "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/abbysale"
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/abuseipdb"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/abyssale"
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/accuweather"
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/adafruitio"
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors/adzuna"
@@ -832,7 +832,7 @@ import (
func buildDetectorList() []detectors.Detector {
return []detectors.Detector{
- &abbysale.Scanner{},
+ &abyssale.Scanner{},
// &abstract.Scanner{},
&abuseipdb.Scanner{},
&accuweather.Scanner{},
diff --git a/pkg/pb/detectorspb/detectors.pb.go b/pkg/pb/detectorspb/detectors.pb.go
index c38e1a52e..ce6427ed6 100644
--- a/pkg/pb/detectorspb/detectors.pb.go
+++ b/pkg/pb/detectorspb/detectors.pb.go
@@ -315,7 +315,7 @@ const (
DetectorType_ZonkaFeedback DetectorType = 236
DetectorType_Delighted DetectorType = 237
DetectorType_Feedier DetectorType = 238
- DetectorType_Abbysale DetectorType = 239
+ DetectorType_Abyssale DetectorType = 239
DetectorType_Magnetic DetectorType = 240
// Deprecated: Marked as deprecated in detectors.proto.
DetectorType_Nytimes DetectorType = 241
@@ -1365,7 +1365,7 @@ var (
236: "ZonkaFeedback",
237: "Delighted",
238: "Feedier",
- 239: "Abbysale",
+ 239: "Abyssale",
240: "Magnetic",
241: "Nytimes",
242: "Polygon",
@@ -2383,7 +2383,7 @@ var (
"ZonkaFeedback": 236,
"Delighted": 237,
"Feedier": 238,
- "Abbysale": 239,
+ "Abyssale": 239,
"Magnetic": 240,
"Nytimes": 241,
"Polygon": 242,
@@ -3867,7 +3867,7 @@ var file_detectors_proto_rawDesc = []byte{
0x65, 0x10, 0xeb, 0x01, 0x12, 0x12, 0x0a, 0x0d, 0x5a, 0x6f, 0x6e, 0x6b, 0x61, 0x46, 0x65, 0x65,
0x64, 0x62, 0x61, 0x63, 0x6b, 0x10, 0xec, 0x01, 0x12, 0x0e, 0x0a, 0x09, 0x44, 0x65, 0x6c, 0x69,
0x67, 0x68, 0x74, 0x65, 0x64, 0x10, 0xed, 0x01, 0x12, 0x0c, 0x0a, 0x07, 0x46, 0x65, 0x65, 0x64,
- 0x69, 0x65, 0x72, 0x10, 0xee, 0x01, 0x12, 0x0d, 0x0a, 0x08, 0x41, 0x62, 0x62, 0x79, 0x73, 0x61,
+ 0x69, 0x65, 0x72, 0x10, 0xee, 0x01, 0x12, 0x0d, 0x0a, 0x08, 0x41, 0x62, 0x79, 0x73, 0x73, 0x61,
0x6c, 0x65, 0x10, 0xef, 0x01, 0x12, 0x0d, 0x0a, 0x08, 0x4d, 0x61, 0x67, 0x6e, 0x65, 0x74, 0x69,
0x63, 0x10, 0xf0, 0x01, 0x12, 0x10, 0x0a, 0x07, 0x4e, 0x79, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x10,
0xf1, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x0c, 0x0a, 0x07, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f,
diff --git a/proto/detectors.proto b/proto/detectors.proto
index 689aa7e71..26309cc49 100644
--- a/proto/detectors.proto
+++ b/proto/detectors.proto
@@ -249,7 +249,7 @@ enum DetectorType {
ZonkaFeedback = 236;
Delighted = 237;
Feedier = 238;
- Abbysale = 239;
+ Abyssale = 239;
Magnetic = 240;
Nytimes = 241 [deprecated = true];
Polygon = 242;