Skip to content

Commit

Permalink
[chore] Use custom HTTP client in sendgrid analyzer (#3178)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcastorina authored Aug 6, 2024
1 parent 1df83f7 commit a373f6b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/analyzer/analyzers/sendgrid/sendgrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"
Expand Down

0 comments on commit a373f6b

Please sign in to comment.