# Communication & Email Service Secrets

[[rule]]
id = "sendgrid-api-key"
name = "SendGrid API Key"
severity = "critical"
pattern = '''\b(SG\.[A-Za-z0-9_-]{15,30}\.[A-Za-z0-9_-]{30,70})\b'''
keywords = ["SG."]
capture = 1

[rule.validate]
prefix = ["SG."]
charset = "A-Za-z0-9_.\\-"
min_length = 50

[[rule]]
id = "twilio-api-key"
name = "Twilio API Key"
severity = "critical"
pattern = '''\b(SK[a-f0-9]{32})\b'''
keywords = ["SK"]
capture = 1

[rule.validate]
prefix = ["SK"]
charset = "A-Za-f0-9"
length = 34

[[rule]]
id = "twilio-auth-token"
name = "Twilio Auth Token"
severity = "critical"
pattern = '''(?i)(?:twilio|TWILIO).{0,30}(?:auth.?token|token|secret).{0,10}['"\s=:]+([a-f0-9]{32})['"\s]?'''
keywords = ["twilio", "TWILIO"]
capture = 1

[rule.validate]
charset = "a-f0-9"
length = 32

[[rule]]
id = "mailchimp-api-key"
name = "Mailchimp API Key"
severity = "high"
pattern = '''\b([a-f0-9]{32}-us[0-9]{1,2})\b'''
keywords = ["mailchimp", "-us"]
capture = 1

[rule.validate]
charset = "a-f0-9-us"
min_length = 35

[[rule]]
id = "mailgun-api-key"
name = "Mailgun API Key"
severity = "critical"
pattern = '''\b(key-[a-f0-9]{32})\b'''
keywords = ["key-", "mailgun"]
capture = 1

[rule.validate]
prefix = ["key-"]
charset = "a-f0-9\\-"
length = 36
