mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 13:34:23 +01:00
Adding clickhouse scanner (#1826)
* Adding clickhouse scanner * removing mention of aws as i used it as template
This commit is contained in:
1 parent
b6cc71aa3a
commit
9bc725786d
3 files changed
+40
-1
No files matched your search
@@ -1,10 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"golang.org/x/exp/slices"
|
|
||||||
"os"
|
"os"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/base"
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/base"
|
||||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/rules"
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/rules"
|
||||||
"github.com/zricethezav/gitleaks/v8/config"
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
@@ -47,6 +48,7 @@ func main() {
|
|||||||
rules.Beamer(),
|
rules.Beamer(),
|
||||||
rules.CodecovAccessToken(),
|
rules.CodecovAccessToken(),
|
||||||
rules.CoinbaseAccessToken(),
|
rules.CoinbaseAccessToken(),
|
||||||
|
rules.ClickHouseCloud(),
|
||||||
rules.Clojars(),
|
rules.Clojars(),
|
||||||
rules.CloudflareAPIKey(),
|
rules.CloudflareAPIKey(),
|
||||||
rules.CloudflareGlobalAPIKey(),
|
rules.CloudflareGlobalAPIKey(),
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/regexp"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ClickHouseCloud() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "clickhouse-cloud-api-secret-key",
|
||||||
|
Description: "Identified a pattern that may indicate clickhouse cloud API secret key, risking unauthorized clickhouse cloud api access and data breaches on ClickHouse Cloud platforms.",
|
||||||
|
Regex: regexp.MustCompile(`\b(4b1d[A-Za-z0-9]{38})\b`),
|
||||||
|
Entropy: 3,
|
||||||
|
Keywords: []string{
|
||||||
|
"4b1d", // Prefix
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := utils.GenerateSampleSecrets("ClickHouse", "4b1dbRdW3rOcB7xLthrM4BTBGK1qPLkHigpN1bXD6z")
|
||||||
|
tps = append(tps, utils.GenerateSampleSecrets("ClickHouse", "4b1d"+secrets.NewSecret("[A-Za-z0-9]{38}"))...)
|
||||||
|
fps := []string{
|
||||||
|
`key = 4b1dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`, // Low entropy
|
||||||
|
`key = adf4b1dbRdW3rOcB7xLthrM4BTBGK1qPLkHigpN1bXD6z`, // Not start of a word
|
||||||
|
}
|
||||||
|
return utils.Validate(r, tps, fps)
|
||||||
|
}
|
||||||
@@ -217,6 +217,13 @@ regex = '''[\w.-]{0,50}?(?i:[\w.-]{0,50}?(?:(?-i:[Mm]eraki|MERAKI))(?:[ \t\w.-]{
|
|||||||
entropy = 3
|
entropy = 3
|
||||||
keywords = ["meraki"]
|
keywords = ["meraki"]
|
||||||
|
|
||||||
|
[[rules]]
|
||||||
|
id = "clickhouse-cloud-api-secret-key"
|
||||||
|
description = "Identified a pattern that may indicate clickhouse cloud API secret key, risking unauthorized clickhouse cloud api access and data breaches on ClickHouse Cloud platforms."
|
||||||
|
regex = '''\b(4b1d[A-Za-z0-9]{38})\b'''
|
||||||
|
entropy = 3
|
||||||
|
keywords = ["4b1d"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "clojars-api-token"
|
id = "clojars-api-token"
|
||||||
description = "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation."
|
description = "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation."
|
||||||
|
|||||||
Reference in new issue
Block a user