Debian Codegraph @

pkg/detectors/sendgrid/sendgrid_detector.go

raw symbols SCIP
1 package sendgrid
2
3 import (
4 "github.com/DefangLabs/secret-detector/pkg/detectors/helpers"
5 "github.com/DefangLabs/secret-detector/pkg/secrets"
6 )
7
8 const (
9 Name = "sendgrid"
10 secretType = "Sendgrid API key"
11
12 // see https://docs.sendgrid.com/ui/account-and-settings/api-keys
13 // https://web.archive.org/web/20200202153737/https://d2w67tjf43xwdp.cloudfront.net/Classroom/Basics/API/what_is_my_api_key.html
14 apiKeyRegex = `SG\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9_-]{43}`
15 )
16
17 func init() {
18 secrets.GetDetectorFactory().Register(Name, NewDetector)
19 }
20
21 type detector struct {
22 secrets.Detector
23 }
24
25 func NewDetector(config ...string) secrets.Detector {
26 return &detector{
27 Detector: helpers.NewRegexDetectorBuilder(secretType, apiKeyRegex).Build(),
28 }
29 }