Skip to content

Find, verify, and analyze leaked credentials

[chore] - Update `discordwebhook` detector keyword (#2954)

ahrav11b80dbdf9e6
diff --git a/pkg/detectors/discordwebhook/discordwebhook.go b/pkg/detectors/discordwebhook/discordwebhook.go
index 899436324..e05a0fba2 100644
--- a/pkg/detectors/discordwebhook/discordwebhook.go
+++ b/pkg/detectors/discordwebhook/discordwebhook.go
@@ -2,10 +2,11 @@ package discordwebhook
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"
@@ -25,9 +26,7 @@ var (
// 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{"discord"}
-}
+func (s Scanner) Keywords() []string { return []string{"https://discord.com/api/webhooks/"} }
// FromData will find and optionally verify DiscordWebhook secrets in a given set of bytes.
func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (results []detectors.Result, err error) {
@@ -46,7 +45,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequestWithContext(ctx, "GET", resMatch, nil)
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, resMatch, nil)
if err != nil {
continue
}
@@ -60,7 +59,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
results = append(results, s1)
-
}
return results, nil