mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6eaad03960 | ||
|
|
09242ce9c8 | ||
|
|
c98e5e0d27 | ||
|
|
4ed0ca4902 | ||
|
|
fb5d707e08 | ||
|
|
50493dbe1f |
No files matched your search
@@ -20,7 +20,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.23
|
go-version: 1.25
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build ./...
|
run: go build ./...
|
||||||
|
|||||||
+3
-3
@@ -1,10 +1,10 @@
|
|||||||
FROM golang:1.23 AS build
|
FROM golang:1.25 AS build
|
||||||
WORKDIR /go/src/github.com/zricethezav/gitleaks
|
WORKDIR /go/src/github.com/zricethezav/gitleaks
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN VERSION=$(git describe --tags --abbrev=0) && \
|
RUN VERSION=$(git describe --tags --abbrev=0) && \
|
||||||
CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X=github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION}"
|
CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X=github.com/zricethezav/gitleaks/v8/version.Version=${VERSION}"
|
||||||
|
|
||||||
FROM alpine:3.19
|
FROM alpine:3.22
|
||||||
RUN apk add --no-cache bash git openssh-client
|
RUN apk add --no-cache bash git openssh-client
|
||||||
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
|
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
PKG=github.com/zricethezav/gitleaks
|
PKG=github.com/zricethezav/gitleaks
|
||||||
VERSION := `git fetch --tags && git tag | sort -V | tail -1`
|
VERSION := `git fetch --tags && git tag | sort -V | tail -1`
|
||||||
LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/v8/cmd.Version=$(VERSION)"
|
LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/v8/version.Version=$(VERSION)"
|
||||||
COVER=--cover --coverprofile=cover.out
|
COVER=--cover --coverprofile=cover.out
|
||||||
|
|
||||||
test-cover:
|
test-cover:
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ func main() {
|
|||||||
rules.AdobeClientID(),
|
rules.AdobeClientID(),
|
||||||
rules.AdobeClientSecret(),
|
rules.AdobeClientSecret(),
|
||||||
rules.AgeSecretKey(),
|
rules.AgeSecretKey(),
|
||||||
rules.Airtable(),
|
rules.AirtableApiKey(),
|
||||||
|
rules.AirtablePersonalAccessToken(),
|
||||||
rules.AlgoliaApiKey(),
|
rules.AlgoliaApiKey(),
|
||||||
rules.AlibabaAccessKey(),
|
rules.AlibabaAccessKey(),
|
||||||
rules.AlibabaSecretKey(),
|
rules.AlibabaSecretKey(),
|
||||||
@@ -152,6 +153,8 @@ func main() {
|
|||||||
rules.LinkedinClientSecret(),
|
rules.LinkedinClientSecret(),
|
||||||
rules.LobAPIToken(),
|
rules.LobAPIToken(),
|
||||||
rules.LobPubAPIToken(),
|
rules.LobPubAPIToken(),
|
||||||
|
rules.LookerClientID(),
|
||||||
|
rules.LookerClientSecret(),
|
||||||
rules.MailChimp(),
|
rules.MailChimp(),
|
||||||
rules.MailGunPubAPIToken(),
|
rules.MailGunPubAPIToken(),
|
||||||
rules.MailGunPrivateAPIToken(),
|
rules.MailGunPrivateAPIToken(),
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
package rules
|
package rules
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
"github.com/zricethezav/gitleaks/v8/config"
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Airtable() *config.Rule {
|
func AirtableApiKey() *config.Rule {
|
||||||
// define rule
|
// define rule
|
||||||
r := config.Rule{
|
r := config.Rule{
|
||||||
Description: "Uncovered a possible Airtable API Key, potentially compromising database access and leading to data leakage or alteration.",
|
Description: "Uncovered a possible Airtable API Key, potentially compromising database access and leading to data leakage or alteration.",
|
||||||
@@ -19,3 +21,17 @@ func Airtable() *config.Rule {
|
|||||||
tps := utils.GenerateSampleSecrets("airtable", secrets.NewSecret(utils.AlphaNumeric("17")))
|
tps := utils.GenerateSampleSecrets("airtable", secrets.NewSecret(utils.AlphaNumeric("17")))
|
||||||
return utils.Validate(r, tps, nil)
|
return utils.Validate(r, tps, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AirtablePersonalAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Uncovered a possible Airtable Personal AccessToken, potentially compromising database access and leading to data leakage or alteration.",
|
||||||
|
RuleID: "airtable-personnal-access-token",
|
||||||
|
Regex: regexp.MustCompile(`\b(pat[[:alnum:]]{14}\.[a-f0-9]{64})\b`),
|
||||||
|
Keywords: []string{"airtable"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := utils.GenerateSampleSecrets("airtable", "pat"+secrets.NewSecret(utils.AlphaNumeric("14")+"\\."+utils.Hex("64")))
|
||||||
|
return utils.Validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
func LookerClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Found a Looker Client ID, risking unauthorized access to a Looker account and exposing sensitive data.",
|
||||||
|
RuleID: "looker-client-id",
|
||||||
|
Regex: utils.GenerateSemiGenericRegex([]string{"looker"}, utils.AlphaNumeric("20"), true),
|
||||||
|
Keywords: []string{"looker"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := utils.GenerateSampleSecrets("looker", secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||||
|
return utils.Validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LookerClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Found a Looker Client Secret, risking unauthorized access to a Looker account and exposing sensitive data.",
|
||||||
|
RuleID: "looker-client-secret",
|
||||||
|
Regex: utils.GenerateSemiGenericRegex([]string{"looker"}, utils.AlphaNumeric("24"), true),
|
||||||
|
Keywords: []string{"looker"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := utils.GenerateSampleSecrets("looker", secrets.NewSecret(utils.AlphaNumeric("24")))
|
||||||
|
return utils.Validate(r, tps, nil)
|
||||||
|
}
|
||||||
+2
-2
@@ -74,7 +74,7 @@ func init() {
|
|||||||
cobra.OnInitialize(initLog)
|
cobra.OnInitialize(initLog)
|
||||||
rootCmd.PersistentFlags().StringP("config", "c", "", configDescription)
|
rootCmd.PersistentFlags().StringP("config", "c", "", configDescription)
|
||||||
rootCmd.PersistentFlags().Int("exit-code", 1, "exit code when leaks have been encountered")
|
rootCmd.PersistentFlags().Int("exit-code", 1, "exit code when leaks have been encountered")
|
||||||
rootCmd.PersistentFlags().StringP("report-path", "r", "", "report file")
|
rootCmd.PersistentFlags().StringP("report-path", "r", "", "report file (use \"-\" for stdout)")
|
||||||
rootCmd.PersistentFlags().StringP("report-format", "f", "", "output format (json, csv, junit, sarif, template)")
|
rootCmd.PersistentFlags().StringP("report-format", "f", "", "output format (json, csv, junit, sarif, template)")
|
||||||
rootCmd.PersistentFlags().StringP("report-template", "", "", "template file used to generate the report (implies --report-format=template)")
|
rootCmd.PersistentFlags().StringP("report-template", "", "", "template file used to generate the report (implies --report-format=template)")
|
||||||
rootCmd.PersistentFlags().StringP("baseline-path", "b", "", "path to baseline with issues that can be ignored")
|
rootCmd.PersistentFlags().StringP("baseline-path", "b", "", "path to baseline with issues that can be ignored")
|
||||||
@@ -88,7 +88,7 @@ func init() {
|
|||||||
rootCmd.PersistentFlags().Bool("no-banner", false, "suppress banner")
|
rootCmd.PersistentFlags().Bool("no-banner", false, "suppress banner")
|
||||||
rootCmd.PersistentFlags().StringSlice("enable-rule", []string{}, "only enable specific rules by id")
|
rootCmd.PersistentFlags().StringSlice("enable-rule", []string{}, "only enable specific rules by id")
|
||||||
rootCmd.PersistentFlags().StringP("gitleaks-ignore-path", "i", ".", "path to .gitleaksignore file or folder containing one")
|
rootCmd.PersistentFlags().StringP("gitleaks-ignore-path", "i", ".", "path to .gitleaksignore file or folder containing one")
|
||||||
rootCmd.PersistentFlags().Int("max-decode-depth", 0, "allow recursive decoding up to this depth (default \"0\", no decoding is done)")
|
rootCmd.PersistentFlags().Int("max-decode-depth", 5, "allow recursive decoding up to this depth")
|
||||||
rootCmd.PersistentFlags().Int("max-archive-depth", 0, "allow scanning into nested archives up to this depth (default \"0\", no archive traversal is done)")
|
rootCmd.PersistentFlags().Int("max-archive-depth", 0, "allow scanning into nested archives up to this depth (default \"0\", no archive traversal is done)")
|
||||||
rootCmd.PersistentFlags().Int("timeout", 0, "set a timeout for gitleaks commands in seconds (default \"0\", no timeout is set)")
|
rootCmd.PersistentFlags().Int("timeout", 0, "set a timeout for gitleaks commands in seconds (default \"0\", no timeout is set)")
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,12 @@ description = "Uncovered a possible Airtable API Key, potentially compromising d
|
|||||||
regex = '''(?i)[\w.-]{0,50}?(?:airtable)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{17})(?:[\x60'"\s;]|\\[nr]|$)'''
|
regex = '''(?i)[\w.-]{0,50}?(?:airtable)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{17})(?:[\x60'"\s;]|\\[nr]|$)'''
|
||||||
keywords = ["airtable"]
|
keywords = ["airtable"]
|
||||||
|
|
||||||
|
[[rules]]
|
||||||
|
id = "airtable-personnal-access-token"
|
||||||
|
description = "Uncovered a possible Airtable Personal AccessToken, potentially compromising database access and leading to data leakage or alteration."
|
||||||
|
regex = '''\b(pat[[:alnum:]]{14}\.[a-f0-9]{64})\b'''
|
||||||
|
keywords = ["airtable"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "algolia-api-key"
|
id = "algolia-api-key"
|
||||||
description = "Identified an Algolia API Key, which could result in unauthorized search operations and data exposure on Algolia-managed platforms."
|
description = "Identified an Algolia API Key, which could result in unauthorized search operations and data exposure on Algolia-managed platforms."
|
||||||
@@ -2523,6 +2529,18 @@ keywords = [
|
|||||||
"_pub",
|
"_pub",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[rules]]
|
||||||
|
id = "looker-client-id"
|
||||||
|
description = "Found a Looker Client ID, risking unauthorized access to a Looker account and exposing sensitive data."
|
||||||
|
regex = '''(?i)[\w.-]{0,50}?(?:looker)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{20})(?:[\x60'"\s;]|\\[nr]|$)'''
|
||||||
|
keywords = ["looker"]
|
||||||
|
|
||||||
|
[[rules]]
|
||||||
|
id = "looker-client-secret"
|
||||||
|
description = "Found a Looker Client Secret, risking unauthorized access to a Looker account and exposing sensitive data."
|
||||||
|
regex = '''(?i)[\w.-]{0,50}?(?:looker)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{24})(?:[\x60'"\s;]|\\[nr]|$)'''
|
||||||
|
keywords = ["looker"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "mailchimp-api-key"
|
id = "mailchimp-api-key"
|
||||||
description = "Identified a Mailchimp API key, potentially compromising email marketing campaigns and subscriber data."
|
description = "Identified a Mailchimp API key, potentially compromising email marketing campaigns and subscriber data."
|
||||||
|
|||||||
Reference in new issue
Block a user