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

This commit is contained in:
Miccah 2024-08-05 17:47:37 -07:00 committed by GitHub
parent 1df83f79ef
commit a373f6bd78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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"