Skip to content

Commit

Permalink
Fix lint warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Cosmin Cojocar <[email protected]>
  • Loading branch information
ccojocar committed Sep 5, 2023
1 parent ba03f43 commit 3a2924b
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions rules/hardcoded_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,155 +35,155 @@ type secretPattern struct {
var secretsPatterns = [...]secretPattern{
{
name: "RSA private key",
regexp: regexp.MustCompile("-----BEGIN RSA PRIVATE KEY-----"),
regexp: regexp.MustCompile(`-----BEGIN RSA PRIVATE KEY-----`),
},
{
name: "SSH (DSA) private key",
regexp: regexp.MustCompile("-----BEGIN DSA PRIVATE KEY-----"),
regexp: regexp.MustCompile(`-----BEGIN DSA PRIVATE KEY-----`),
},
{
name: "SSH (EC) private key",
regexp: regexp.MustCompile("-----BEGIN EC PRIVATE KEY-----"),
regexp: regexp.MustCompile(`-----BEGIN EC PRIVATE KEY-----`),
},
{
name: "PGP private key block",
regexp: regexp.MustCompile("-----BEGIN PGP PRIVATE KEY BLOCK-----"),
regexp: regexp.MustCompile(`-----BEGIN PGP PRIVATE KEY BLOCK-----`),
},
{
name: "Slack Token",
regexp: regexp.MustCompile("xox[pborsa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32}"),
regexp: regexp.MustCompile(`xox[pborsa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32}`),
},
{
name: "AWS API Key",
regexp: regexp.MustCompile("AKIA[0-9A-Z]{16}"),
regexp: regexp.MustCompile(`AKIA[0-9A-Z]{16}`),
},
{
name: "Amazon MWS Auth Token",
regexp: regexp.MustCompile("amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"),
regexp: regexp.MustCompile(`amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`),
},
{
name: "AWS AppSync GraphQL Key",
regexp: regexp.MustCompile("da2-[a-z0-9]{26}"),
regexp: regexp.MustCompile(`da2-[a-z0-9]{26}`),
},
{
name: "GitHub personal access token",
regexp: regexp.MustCompile("ghp_[a-zA-Z0-9]{36}"),
regexp: regexp.MustCompile(`ghp_[a-zA-Z0-9]{36}`),
},
{
name: "GitHub fine-grained access token",
regexp: regexp.MustCompile("github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59}"),
regexp: regexp.MustCompile(`github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59}`),
},
{
name: "GitHub action temporary token",
regexp: regexp.MustCompile("ghs_[a-zA-Z0-9]{36}"),
regexp: regexp.MustCompile(`ghs_[a-zA-Z0-9]{36}`),
},
{
name: "Google API Key",
regexp: regexp.MustCompile("AIza[0-9A-Za-z\\-_]{35}"),
regexp: regexp.MustCompile(`AIza[0-9A-Za-z\\-_]{35}`),
},
{
name: "Google Cloud Platform API Key",
regexp: regexp.MustCompile("AIza[0-9A-Za-z\\-_]{35}"),
regexp: regexp.MustCompile(`AIza[0-9A-Za-z\\-_]{35}`),
},
{
name: "Google Cloud Platform OAuth",
regexp: regexp.MustCompile("[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com"),
regexp: regexp.MustCompile(`[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com`),
},
{
name: "Google Drive API Key",
regexp: regexp.MustCompile("AIza[0-9A-Za-z\\-_]{35}"),
regexp: regexp.MustCompile(`AIza[0-9A-Za-z\\-_]{35}`),
},
{
name: "Google Drive OAuth",
regexp: regexp.MustCompile("[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com"),
regexp: regexp.MustCompile(`[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com`),
},
{
name: "Google (GCP) Service-account",
regexp: regexp.MustCompile("\"type\": \"service_account\""),
regexp: regexp.MustCompile(`"type": "service_account"`),
},
{
name: "Google Gmail API Key",
regexp: regexp.MustCompile("AIza[0-9A-Za-z\\-_]{35}"),
regexp: regexp.MustCompile(`AIza[0-9A-Za-z\\-_]{35}`),
},
{
name: "Google Gmail OAuth",
regexp: regexp.MustCompile("[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com"),
regexp: regexp.MustCompile(`[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com`),
},
{
name: "Google OAuth Access Token",
regexp: regexp.MustCompile("ya29\\.[0-9A-Za-z\\-_]+"),
regexp: regexp.MustCompile(`ya29\\.[0-9A-Za-z\\-_]+`),
},
{
name: "Google YouTube API Key",
regexp: regexp.MustCompile("AIza[0-9A-Za-z\\-_]{35}"),
regexp: regexp.MustCompile(`AIza[0-9A-Za-z\\-_]{35}`),
},
{
name: "Google YouTube OAuth",
regexp: regexp.MustCompile("[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com"),
regexp: regexp.MustCompile(`[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com`),
},
{
name: "Generic API Key",
regexp: regexp.MustCompile("[aA][pP][iI]_?[kK][eE][yY].*[''|\"][0-9a-zA-Z]{32,45}[''|\"]"),
regexp: regexp.MustCompile(`[aA][pP][iI]_?[kK][eE][yY].*[''|"][0-9a-zA-Z]{32,45}[''|"]`),
},
{
name: "Generic Secret",
regexp: regexp.MustCompile("[sS][eE][cC][rR][eE][tT].*[''|\"][0-9a-zA-Z]{32,45}[''|\"]"),
regexp: regexp.MustCompile(`[sS][eE][cC][rR][eE][tT].*[''|"][0-9a-zA-Z]{32,45}[''|"]`),
},
{
name: "Heroku API Key",
regexp: regexp.MustCompile("[hH][eE][rR][oO][kK][uU].*[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}"),
regexp: regexp.MustCompile(`[hH][eE][rR][oO][kK][uU].*[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`),
},
{
name: "MailChimp API Key",
regexp: regexp.MustCompile("[0-9a-f]{32}-us[0-9]{1,2}"),
regexp: regexp.MustCompile(`[0-9a-f]{32}-us[0-9]{1,2}`),
},
{
name: "Mailgun API Key",
regexp: regexp.MustCompile("key-[0-9a-zA-Z]{32}"),
regexp: regexp.MustCompile(`key-[0-9a-zA-Z]{32}`),
},
{
name: "Password in URL",
regexp: regexp.MustCompile("[a-zA-Z]{3,10}://[^/\\s:@]{3,20}:[^/\\s:@]{3,20}@.{1,100}[\"'\\s]"),
regexp: regexp.MustCompile(`[a-zA-Z]{3,10}://[^/\\s:@]{3,20}:[^/\\s:@]{3,20}@.{1,100}["'\\s]`),
},
{
name: "Slack Webhook",
regexp: regexp.MustCompile("https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}"),
regexp: regexp.MustCompile(`https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}`),
},
{
name: "Stripe API Key",
regexp: regexp.MustCompile("sk_live_[0-9a-zA-Z]{24}"),
regexp: regexp.MustCompile(`sk_live_[0-9a-zA-Z]{24}`),
},
{
name: "Stripe API Key",
regexp: regexp.MustCompile("sk_live_[0-9a-zA-Z]{24}"),
regexp: regexp.MustCompile(`sk_live_[0-9a-zA-Z]{24}`),
},
{
name: "Stripe Restricted API Key",
regexp: regexp.MustCompile("rk_live_[0-9a-zA-Z]{24}"),
regexp: regexp.MustCompile(`rk_live_[0-9a-zA-Z]{24}`),
},
{
name: "Square Access Token",
regexp: regexp.MustCompile("sq0atp-[0-9A-Za-z\\-_]{22}"),
regexp: regexp.MustCompile(`sq0atp-[0-9A-Za-z\\-_]{22}`),
},
{
name: "Square OAuth Secret",
regexp: regexp.MustCompile("sq0csp-[0-9A-Za-z\\-_]{43}"),
regexp: regexp.MustCompile(`sq0csp-[0-9A-Za-z\\-_]{43}`),
},
{
name: "Telegram Bot API Key",
regexp: regexp.MustCompile("[0-9]+:AA[0-9A-Za-z\\-_]{33}"),
regexp: regexp.MustCompile(`[0-9]+:AA[0-9A-Za-z\\-_]{33}`),
},
{
name: "Twilio API Key",
regexp: regexp.MustCompile("SK[0-9a-fA-F]{32}"),
regexp: regexp.MustCompile(`SK[0-9a-fA-F]{32}`),
},
{
name: "Twitter Access Token",
regexp: regexp.MustCompile("[tT][wW][iI][tT][tT][eE][rR].*[1-9][0-9]+-[0-9a-zA-Z]{40}"),
regexp: regexp.MustCompile(`[tT][wW][iI][tT][tT][eE][rR].*[1-9][0-9]+-[0-9a-zA-Z]{40}`),
},
{
name: "Twitter OAuth",
regexp: regexp.MustCompile("[tT][wW][iI][tT][tT][eE][rR].*[''|\"][0-9a-zA-Z]{35,44}[''|\"]"),
regexp: regexp.MustCompile(`[tT][wW][iI][tT][tT][eE][rR].*[''|"][0-9a-zA-Z]{35,44}[''|"]`),
},
}

Expand Down

0 comments on commit 3a2924b

Please sign in to comment.