Skip to content

Find, verify, and analyze leaked credentials

[chore] Use custom HTTP client in sendgrid analyzer (#3178)

Miccaha373f6bd78fb
diff --git a/pkg/analyzer/analyzers/sendgrid/sendgrid.go b/pkg/analyzer/analyzers/sendgrid/sendgrid.go
index 14bf19c48..25c239d92 100644
--- a/pkg/analyzer/analyzers/sendgrid/sendgrid.go
+++ b/pkg/analyzer/analyzers/sendgrid/sendgrid.go
@@ -85,13 +85,6 @@ func processPermissions(rawScopes []string) {
}
func AnalyzeAndPrintPermissions(cfg *config.Config, key string) {
-
- // ToDo: Add logging when rewrite to not use SG client.
- if cfg.LoggingEnabled {
- color.Red("[x] Logging not supported for GitHub Token Analysis.")
- return
- }
-
info, err := AnalyzePermissions(cfg, key)
if err != nil {
color.Red("[!] Error: %v", err)
@@ -116,6 +109,8 @@ func AnalyzeAndPrintPermissions(cfg *config.Config, key string) {
}
func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error) {
+ // Setup custom HTTP client so we can log requests.
+ sg.DefaultClient.HTTPClient = analyzers.NewAnalyzeClient(cfg)
req := sg.GetRequest(key, "/v3/scopes", "https://api.sendgrid.com")
req.Method = "GET"