Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Detect Chargebee Access Tokens #1335

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/generate/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func main() {
rules.BittrexAccessKey(),
rules.BittrexSecretKey(),
rules.Beamer(),
rules.ChargebeeAccessToken(),
rules.CodecovAccessToken(),
rules.CoinbaseAccessToken(),
rules.Clojars(),
Expand Down
24 changes: 24 additions & 0 deletions cmd/generate/config/rules/chargebee.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package rules

import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)

func ChargebeeAccessToken() *config.Rule {
// define rule
r := config.Rule{
Description: "Found a Chargebee Access Token, posing a risk to subscription management, payment processing services and sensitive financial data.",
RuleID: "chargebee-access-token",
Regex: generateUniqueTokenRegex(`(test|live)_[0-9a-zA-Z]{32,34}`, true),
Keywords: []string{
"test_",
"live_",
},
}

// validate
tps := []string{"chargebeeToken := \"test_" + secrets.NewSecret(alphaNumeric("32")) + "\""}
fps := []string{"nonMatchingToken := \"" + secrets.NewSecret(alphaNumeric("32")) + "\""}
return validate(r, tps, fps)
}
1 change: 1 addition & 0 deletions cmd/generate/config/rules/stopwords.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ var DefaultStopWords = []string{
"changelog",
"channel",
"chart",
"chargebee",
"chat",
"cheat",
"check",
Expand Down
9 changes: 9 additions & 0 deletions config/gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ keywords = [
"bittrex",
]

[[rules]]
id = "chargebee-access-token"
description = "Found a Chargebee Access Token, posing a risk to subscription management, payment processing services and sensitive financial data."
regex = '''(?i)\b((test|live)_[0-9a-zA-Z]{32,34})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
keywords = [
"test_","live_",
]

[[rules]]
id = "clojars-api-token"
description = "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation."
Expand Down Expand Up @@ -667,6 +675,7 @@ stopwords = [
"changelog",
"channel",
"chart",
"chargebee",
"chat",
"cheat",
"check",
Expand Down