mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3188ad6005 | ||
|
|
7fc11bb264 | ||
|
|
36c52c6b73 | ||
|
|
1f323d8b69 |
No files matched your search
+1
-2
@@ -96,10 +96,10 @@ func runDetect(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var (
|
var (
|
||||||
|
logOpts = mustGetStringFlag(cmd, "log-opts")
|
||||||
gitCmd *sources.GitCmd
|
gitCmd *sources.GitCmd
|
||||||
scmPlatform scm.Platform
|
scmPlatform scm.Platform
|
||||||
remote *detect.RemoteInfo
|
remote *detect.RemoteInfo
|
||||||
logOpts string
|
|
||||||
)
|
)
|
||||||
if gitCmd, err = sources.NewGitLogCmd(source, logOpts); err != nil {
|
if gitCmd, err = sources.NewGitLogCmd(source, logOpts); err != nil {
|
||||||
logging.Fatal().Err(err).Msg("could not create Git cmd")
|
logging.Fatal().Err(err).Msg("could not create Git cmd")
|
||||||
@@ -110,7 +110,6 @@ func runDetect(cmd *cobra.Command, args []string) {
|
|||||||
if remote, err = detect.NewRemoteInfo(scmPlatform, source); err != nil {
|
if remote, err = detect.NewRemoteInfo(scmPlatform, source); err != nil {
|
||||||
logging.Fatal().Err(err).Msg("failed to scan Git repository")
|
logging.Fatal().Err(err).Msg("failed to scan Git repository")
|
||||||
}
|
}
|
||||||
logOpts = mustGetStringFlag(cmd, "log-opts")
|
|
||||||
|
|
||||||
if findings, err = detector.DetectGit(gitCmd, remote); err != nil {
|
if findings, err = detector.DetectGit(gitCmd, remote); err != nil {
|
||||||
// don't exit on error, just log it
|
// don't exit on error, just log it
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ func CreateGlobalConfig() config.Config {
|
|||||||
}(),
|
}(),
|
||||||
|
|
||||||
// ----------- Environment Variables -----------
|
// ----------- Environment Variables -----------
|
||||||
regexp.MustCompile(`^\$(\d+|{\d+})$`),
|
regexp.MustCompile(`^\$(?:\d+|{\d+})$`),
|
||||||
regexp.MustCompile(`^\$([A-Z_]+|[a-z_]+)$`),
|
regexp.MustCompile(`^\$(?:[A-Z_]+|[a-z_]+)$`),
|
||||||
regexp.MustCompile(`^\${([A-Z_]+|[a-z_]+)}$`),
|
regexp.MustCompile(`^\${(?:[A-Z_]+|[a-z_]+)}$`),
|
||||||
|
|
||||||
// ----------- Interpolated Variables -----------
|
// ----------- Interpolated Variables -----------
|
||||||
// Ansible (https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html)
|
// Ansible (https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html)
|
||||||
@@ -43,14 +43,14 @@ func CreateGlobalConfig() config.Config {
|
|||||||
// GitHub Actions
|
// GitHub Actions
|
||||||
// https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables
|
// https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables
|
||||||
// https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions
|
// https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions
|
||||||
regexp.MustCompile(`^\$\{\{[ \t]*((env|github|secrets|vars)(\.[A-Za-z]\w+)+[\w "'&./=|]*)[ \t]*}}$`),
|
regexp.MustCompile(`^\$\{\{[ \t]*(?:(?:env|github|secrets|vars)(?:\.[A-Za-z]\w+)+[\w "'&./=|]*)[ \t]*}}$`),
|
||||||
// NuGet (https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file#using-environment-variables)
|
// NuGet (https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file#using-environment-variables)
|
||||||
regexp.MustCompile(`^%([A-Z_]+|[a-z_]+)%$`),
|
regexp.MustCompile(`^%(?:[A-Z_]+|[a-z_]+)%$`),
|
||||||
// String formatting.
|
// String formatting.
|
||||||
regexp.MustCompile(`^%[+\-# 0]?[bcdeEfFgGoOpqstTUvxX]$`), // Golang (https://pkg.go.dev/fmt)
|
regexp.MustCompile(`^%[+\-# 0]?[bcdeEfFgGoOpqstTUvxX]$`), // Golang (https://pkg.go.dev/fmt)
|
||||||
regexp.MustCompile(`^\{\d{0,2}}$`), // Python (https://docs.python.org/3/tutorial/inputoutput.html)
|
regexp.MustCompile(`^\{\d{0,2}}$`), // Python (https://docs.python.org/3/tutorial/inputoutput.html)
|
||||||
// Urban Code Deploy (https://www.ibm.com/support/pages/replace-token-step-replaces-replacement-values-windows-variables)
|
// Urban Code Deploy (https://www.ibm.com/support/pages/replace-token-step-replaces-replacement-values-windows-variables)
|
||||||
regexp.MustCompile(`^@([A-Z_]+|[a-z_]+)@$`),
|
regexp.MustCompile(`^@(?:[A-Z_]+|[a-z_]+)@$`),
|
||||||
|
|
||||||
// ----------- Miscellaneous -----------
|
// ----------- Miscellaneous -----------
|
||||||
},
|
},
|
||||||
@@ -58,42 +58,42 @@ func CreateGlobalConfig() config.Config {
|
|||||||
regexp.MustCompile(`gitleaks\.toml`),
|
regexp.MustCompile(`gitleaks\.toml`),
|
||||||
|
|
||||||
// ----------- Documents and media -----------
|
// ----------- Documents and media -----------
|
||||||
regexp.MustCompile(`(?i)\.(bmp|gif|jpe?g|svg|tiff?)$`), // Images
|
regexp.MustCompile(`(?i)\.(?:bmp|gif|jpe?g|png|svg|tiff?)$`), // Images
|
||||||
regexp.MustCompile(`\.(eot|[ot]tf|woff2?)$`), // Fonts
|
regexp.MustCompile(`(?i)\.(?:eot|[ot]tf|woff2?)$`), // Fonts
|
||||||
regexp.MustCompile(`(.*?)(doc|docx|zip|xls|pdf|bin|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe|gltf)$`),
|
regexp.MustCompile(`(?i)\.(?:docx?|xlsx?|pdf|bin|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe|gltf|zip)$`),
|
||||||
|
|
||||||
// ----------- Golang files -----------
|
// ----------- Golang files -----------
|
||||||
regexp.MustCompile(`go\.(mod|sum|work(\.sum)?)$`),
|
regexp.MustCompile(`go\.(?:mod|sum|work(?:\.sum)?)$`),
|
||||||
regexp.MustCompile(`(^|/)vendor/modules\.txt$`),
|
regexp.MustCompile(`(?:^|/)vendor/modules\.txt$`),
|
||||||
regexp.MustCompile(`(^|/)vendor/(github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)(/.*)?$`),
|
regexp.MustCompile(`(?:^|/)vendor/(?:github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)(?:/.*)?$`),
|
||||||
|
|
||||||
// ----------- Java files -----------
|
// ----------- Java files -----------
|
||||||
// Gradle
|
// Gradle
|
||||||
regexp.MustCompile(`(^|/)gradlew(\.bat)?$`),
|
regexp.MustCompile(`(?:^|/)gradlew(?:\.bat)?$`),
|
||||||
regexp.MustCompile(`(^|/)gradle\.lockfile$`),
|
regexp.MustCompile(`(?:^|/)gradle\.lockfile$`),
|
||||||
regexp.MustCompile(`(^|/)mvnw(\.cmd)?$`),
|
regexp.MustCompile(`(?:^|/)mvnw(?:\.cmd)?$`),
|
||||||
regexp.MustCompile(`(^|/)\.mvn/wrapper/MavenWrapperDownloader\.java$`),
|
regexp.MustCompile(`(?:^|/)\.mvn/wrapper/MavenWrapperDownloader\.java$`),
|
||||||
|
|
||||||
// ----------- JavaScript files -----------
|
// ----------- JavaScript files -----------
|
||||||
// Dependencies and lock files.
|
// Dependencies and lock files.
|
||||||
regexp.MustCompile(`(^|/)node_modules(/.*)?$`),
|
regexp.MustCompile(`(?:^|/)node_modules(?:/.*)?$`),
|
||||||
regexp.MustCompile(`(^|/)(npm-shrinkwrap\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$`),
|
regexp.MustCompile(`(?:^|/)(?:npm-shrinkwrap\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$`),
|
||||||
regexp.MustCompile(`(^|/)bower_components(/.*)?$`),
|
regexp.MustCompile(`(?:^|/)bower_components(?:/.*)?$`),
|
||||||
// TODO: Add more common static assets, such as swagger-ui.
|
// TODO: Add more common static assets, such as swagger-ui.
|
||||||
regexp.MustCompile(`(^|/)(angular|bootstrap|jquery(-?ui)?|plotly|swagger-?ui)[a-zA-Z0-9.-]*(\.min)?\.js(\.map)?$`),
|
regexp.MustCompile(`(?:^|/)(?:angular|bootstrap|jquery(?:-?ui)?|plotly|swagger-?ui)[a-zA-Z0-9.-]*(?:\.min)?\.js(?:\.map)?$`),
|
||||||
regexp.MustCompile(`(^|/)javascript\.json$`),
|
regexp.MustCompile(`(?:^|/)javascript\.json$`),
|
||||||
|
|
||||||
// ----------- Python files -----------
|
// ----------- Python files -----------
|
||||||
// Dependencies and lock files.
|
// Dependencies and lock files.
|
||||||
regexp.MustCompile(`(^|/)(Pipfile|poetry)\.lock$`),
|
regexp.MustCompile(`(?:^|/)(?:Pipfile|poetry)\.lock$`),
|
||||||
// Virtual environments
|
// Virtual environments
|
||||||
regexp.MustCompile(`(?i)/?(v?env|virtualenv)/lib(64)?(/.*)?$`),
|
regexp.MustCompile(`(?i)(?:^|/)(?:v?env|virtualenv)/lib(?:64)?(?:/.*)?$`),
|
||||||
regexp.MustCompile(`(?i)(^|/)(lib(64)?/python[23](\.\d{1,2})+|python/[23](\.\d{1,2})+/lib(64)?)(/.*)?$`),
|
regexp.MustCompile(`(?i)(?:^|/)(?:lib(?:64)?/python[23](?:\.\d{1,2})+|python/[23](?:\.\d{1,2})+/lib(?:64)?)(?:/.*)?$`),
|
||||||
// dist-info directory (https://py-pkgs.org/04-package-structure.html#building-sdists-and-wheels)
|
// dist-info directory (https://py-pkgs.org/04-package-structure.html#building-sdists-and-wheels)
|
||||||
regexp.MustCompile(`(?i)(^|/)[a-z0-9_.]+-[0-9.]+\.dist-info(/.+)?$`),
|
regexp.MustCompile(`(?i)(?:^|/)[a-z0-9_.]+-[0-9.]+\.dist-info(?:/.+)?$`),
|
||||||
|
|
||||||
// ----------- Ruby files -----------
|
// ----------- Ruby files -----------
|
||||||
regexp.MustCompile(`(^|/)vendor/(bundle|ruby)(/.*?)?$`),
|
regexp.MustCompile(`(?:^|/)vendor/(?:bundle|ruby)(?:/.*?)?$`),
|
||||||
regexp.MustCompile(`\.gem$`), // tar archive
|
regexp.MustCompile(`\.gem$`), // tar archive
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
|
|||||||
@@ -4,70 +4,70 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConfigAllowlistRegexes(t *testing.T) {
|
var allowlistRegexTests = map[string]struct {
|
||||||
tests := map[string]struct {
|
invalid []string
|
||||||
invalid []string
|
valid []string
|
||||||
valid []string
|
}{
|
||||||
}{
|
"general placeholders": {
|
||||||
"general placeholders": {
|
invalid: []string{
|
||||||
invalid: []string{
|
`true`, `True`, `false`, `False`, `null`, `NULL`,
|
||||||
`true`, `True`, `false`, `False`, `null`, `NULL`,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"general placeholders - repeated characters": {
|
},
|
||||||
invalid: []string{
|
"general placeholders - repeated characters": {
|
||||||
`aaaaaaaaaaaaaaaaa`, `BBBBBBBBBBbBBBBBBBbBB`, `********************`,
|
invalid: []string{
|
||||||
},
|
`aaaaaaaaaaaaaaaaa`, `BBBBBBBBBBbBBBBBBBbBB`, `********************`,
|
||||||
valid: []string{`aaaaaaaaaaaaaaaaaaabaa`, `pas*************d`},
|
|
||||||
},
|
},
|
||||||
"environment variables": {
|
valid: []string{`aaaaaaaaaaaaaaaaaaabaa`, `pas*************d`},
|
||||||
invalid: []string{`$2`, `$GIT_PASSWORD`, `${GIT_PASSWORD}`, `$password`},
|
},
|
||||||
valid: []string{`$yP@R.@=ibxI`, `$2a6WCust9aE`, `${not_complete1`},
|
"environment variables": {
|
||||||
|
invalid: []string{`$2`, `$GIT_PASSWORD`, `${GIT_PASSWORD}`, `$password`},
|
||||||
|
valid: []string{`$yP@R.@=ibxI`, `$2a6WCust9aE`, `${not_complete1`},
|
||||||
|
},
|
||||||
|
"interpolated variables - ansible": {
|
||||||
|
invalid: []string{
|
||||||
|
`{{ x }}`, `{{ password }}`, `{{password}}`, `{{ data.proxy_password }}`,
|
||||||
|
`{{ dict1 | ansible.builtin.combine(dict2) }}`,
|
||||||
},
|
},
|
||||||
"interpolated variables - ansible": {
|
},
|
||||||
invalid: []string{
|
"interpolated variables - github actions": {
|
||||||
`{{ x }}`, `{{ password }}`, `{{password}}`, `{{ data.proxy_password }}`,
|
invalid: []string{
|
||||||
`{{ dict1 | ansible.builtin.combine(dict2) }}`,
|
`${{ env.First_Name }}`,
|
||||||
},
|
`${{ env.DAY_OF_WEEK == 'Monday' }}`,
|
||||||
|
`${{env.JAVA_VERSION}}`,
|
||||||
|
`${{ github.event.issue.title }}`,
|
||||||
|
`${{ github.repository == "Gattocrucco/lsqfitgp" }}`,
|
||||||
|
`${{ github.event.pull_request.number || github.ref }}`,
|
||||||
|
`${{ github.event_name == 'pull_request' && github.event.action == 'unassigned' }}`,
|
||||||
|
`${{ secrets.SuperSecret }}`,
|
||||||
|
`${{ vars.JOB_NAME }}`,
|
||||||
|
`${{ vars.USE_VARIABLES == 'true' }}`,
|
||||||
},
|
},
|
||||||
"interpolated variables - github actions": {
|
},
|
||||||
invalid: []string{
|
"interpolated variables - nuget": {
|
||||||
`${{ env.First_Name }}`,
|
invalid: []string{
|
||||||
`${{ env.DAY_OF_WEEK == 'Monday' }}`,
|
`%MY_PASSWORD%`, `%password%`,
|
||||||
`${{env.JAVA_VERSION}}`,
|
|
||||||
`${{ github.event.issue.title }}`,
|
|
||||||
`${{ github.repository == "Gattocrucco/lsqfitgp" }}`,
|
|
||||||
`${{ github.event.pull_request.number || github.ref }}`,
|
|
||||||
`${{ github.event_name == 'pull_request' && github.event.action == 'unassigned' }}`,
|
|
||||||
`${{ secrets.SuperSecret }}`,
|
|
||||||
`${{ vars.JOB_NAME }}`,
|
|
||||||
`${{ vars.USE_VARIABLES == 'true' }}`,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"interpolated variables - nuget": {
|
},
|
||||||
invalid: []string{
|
"interpolated variables - string fmt - golang": {
|
||||||
`%MY_PASSWORD%`, `%password%`,
|
invalid: []string{
|
||||||
},
|
`%b`, `%c`, `%d`, `% d`, `%e`, `%E`, `%f`, `%F`, `%g`, `%G`, `%o`, `%O`, `%p`, `%q`, `%-s`, `%s`, `%t`, `%T`, `%U`, `%#U`, `%+v`, `%#v`, `%v`, `%x`, `%X`,
|
||||||
},
|
},
|
||||||
"interpolated variables - string fmt - golang": {
|
},
|
||||||
invalid: []string{
|
"interpolated variables - string fmt - python": {
|
||||||
`%b`, `%c`, `%d`, `% d`, `%e`, `%E`, `%f`, `%F`, `%g`, `%G`, `%o`, `%O`, `%p`, `%q`, `%-s`, `%s`, `%t`, `%T`, `%U`, `%#U`, `%+v`, `%#v`, `%v`, `%x`, `%X`,
|
invalid: []string{
|
||||||
},
|
`{}`, `{0}`, `{10}`,
|
||||||
},
|
},
|
||||||
"interpolated variables - string fmt - python": {
|
},
|
||||||
invalid: []string{
|
"interpolated variables - ucd": {
|
||||||
`{}`, `{0}`, `{10}`,
|
invalid: []string{`@password@`, `@LDAP_PASS@`},
|
||||||
},
|
valid: []string{`@username@mastodon.example`},
|
||||||
},
|
},
|
||||||
"interpolated variables - ucd": {
|
}
|
||||||
invalid: []string{`@password@`, `@LDAP_PASS@`},
|
|
||||||
valid: []string{`@username@mastodon.example`},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
func TestConfigAllowlistRegexes(t *testing.T) {
|
||||||
cfg := CreateGlobalConfig()
|
cfg := CreateGlobalConfig()
|
||||||
allowlist := cfg.Allowlist
|
allowlist := cfg.Allowlist
|
||||||
for name, cases := range tests {
|
for name, cases := range allowlistRegexTests {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
for _, c := range cases.invalid {
|
for _, c := range cases.invalid {
|
||||||
if !allowlist.RegexAllowed(c) {
|
if !allowlist.RegexAllowed(c) {
|
||||||
@@ -84,51 +84,67 @@ func TestConfigAllowlistRegexes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigAllowlistPaths(t *testing.T) {
|
func BenchmarkConfigAllowlistRegexes(b *testing.B) {
|
||||||
tests := map[string]struct {
|
|
||||||
invalid []string
|
|
||||||
valid []string
|
|
||||||
}{
|
|
||||||
"javascript - common static assets": {
|
|
||||||
invalid: []string{
|
|
||||||
`tests/e2e/nuget/wwwroot/lib/bootstrap/dist/js/bootstrap.esm.min.js`,
|
|
||||||
`src/main/static/lib/angular.1.2.16.min.js`,
|
|
||||||
`src/main/resources/static/jquery-ui-1.12.1/jquery-ui-min.js`,
|
|
||||||
`src/main/resources/static/js/jquery-ui-1.10.4.min.js`,
|
|
||||||
`src-static/js/plotly.min.js`,
|
|
||||||
`swagger/swaggerui/swagger-ui-bundle.js.map`,
|
|
||||||
`swagger/swaggerui/swagger-ui-es-bundle.js.map`,
|
|
||||||
`src/main/static/swagger-ui.min.js`,
|
|
||||||
`swagger/swaggerui/swagger-ui.js`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"python": {
|
|
||||||
invalid: []string{
|
|
||||||
// lock files
|
|
||||||
`Pipfile.lock`, `poetry.lock`,
|
|
||||||
// virtual environments
|
|
||||||
"env/lib/python3.7/site-packages/urllib3/util/url.py",
|
|
||||||
"venv/Lib/site-packages/regex-2018.08.29.dist-info/DESCRIPTION.rst",
|
|
||||||
"venv/lib64/python3.5/site-packages/pynvml.py",
|
|
||||||
"python/python3/virtualenv/Lib/site-packages/pyphonetics/utils.py",
|
|
||||||
"virtualenv/lib64/python3.7/base64.py",
|
|
||||||
// packages
|
|
||||||
"cde-root/usr/lib64/python2.4/site-packages/Numeric.pth",
|
|
||||||
"lib/python3.9/site-packages/setuptools/_distutils/msvccompiler.py",
|
|
||||||
"lib/python3.8/site-packages/botocore/data/alexaforbusiness/2017-11-09/service-2.json",
|
|
||||||
"code/python/3.7.4/Lib/site-packages/dask/bytes/tests/test_bytes_utils.py",
|
|
||||||
"python/3.7.4/Lib/site-packages/fsspec/utils.py",
|
|
||||||
"python/2.7.16.32/Lib/bsddb/test/test_dbenv.py",
|
|
||||||
"python/lib/python3.8/site-packages/boto3/data/ec2/2016-04-01/resources-1.json",
|
|
||||||
// distinfo
|
|
||||||
"libs/PyX-0.15.dist-info/AUTHORS",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg := CreateGlobalConfig()
|
cfg := CreateGlobalConfig()
|
||||||
allowlist := cfg.Allowlist
|
allowlist := cfg.Allowlist
|
||||||
for name, cases := range tests {
|
for n := 0; n < b.N; n++ {
|
||||||
|
for _, cases := range allowlistRegexTests {
|
||||||
|
for _, c := range cases.invalid {
|
||||||
|
allowlist.RegexAllowed(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, c := range cases.valid {
|
||||||
|
allowlist.RegexAllowed(c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var allowlistPathsTests = map[string]struct {
|
||||||
|
invalid []string
|
||||||
|
valid []string
|
||||||
|
}{
|
||||||
|
"javascript - common static assets": {
|
||||||
|
invalid: []string{
|
||||||
|
`tests/e2e/nuget/wwwroot/lib/bootstrap/dist/js/bootstrap.esm.min.js`,
|
||||||
|
`src/main/static/lib/angular.1.2.16.min.js`,
|
||||||
|
`src/main/resources/static/jquery-ui-1.12.1/jquery-ui-min.js`,
|
||||||
|
`src/main/resources/static/js/jquery-ui-1.10.4.min.js`,
|
||||||
|
`src-static/js/plotly.min.js`,
|
||||||
|
`swagger/swaggerui/swagger-ui-bundle.js.map`,
|
||||||
|
`swagger/swaggerui/swagger-ui-es-bundle.js.map`,
|
||||||
|
`src/main/static/swagger-ui.min.js`,
|
||||||
|
`swagger/swaggerui/swagger-ui.js`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"python": {
|
||||||
|
invalid: []string{
|
||||||
|
// lock files
|
||||||
|
`Pipfile.lock`, `poetry.lock`,
|
||||||
|
// virtual environments
|
||||||
|
"env/lib/python3.7/site-packages/urllib3/util/url.py",
|
||||||
|
"venv/Lib/site-packages/regex-2018.08.29.dist-info/DESCRIPTION.rst",
|
||||||
|
"venv/lib64/python3.5/site-packages/pynvml.py",
|
||||||
|
"python/python3/virtualenv/Lib/site-packages/pyphonetics/utils.py",
|
||||||
|
"virtualenv/lib64/python3.7/base64.py",
|
||||||
|
// packages
|
||||||
|
"cde-root/usr/lib64/python2.4/site-packages/Numeric.pth",
|
||||||
|
"lib/python3.9/site-packages/setuptools/_distutils/msvccompiler.py",
|
||||||
|
"lib/python3.8/site-packages/botocore/data/alexaforbusiness/2017-11-09/service-2.json",
|
||||||
|
"code/python/3.7.4/Lib/site-packages/dask/bytes/tests/test_bytes_utils.py",
|
||||||
|
"python/3.7.4/Lib/site-packages/fsspec/utils.py",
|
||||||
|
"python/2.7.16.32/Lib/bsddb/test/test_dbenv.py",
|
||||||
|
"python/lib/python3.8/site-packages/boto3/data/ec2/2016-04-01/resources-1.json",
|
||||||
|
// distinfo
|
||||||
|
"libs/PyX-0.15.dist-info/AUTHORS",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestConfigAllowlistPaths(t *testing.T) {
|
||||||
|
cfg := CreateGlobalConfig()
|
||||||
|
allowlist := cfg.Allowlist
|
||||||
|
for name, cases := range allowlistPathsTests {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
for _, c := range cases.invalid {
|
for _, c := range cases.invalid {
|
||||||
if !allowlist.PathAllowed(c) {
|
if !allowlist.PathAllowed(c) {
|
||||||
@@ -144,3 +160,19 @@ func TestConfigAllowlistPaths(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkConfigAllowlistPaths(b *testing.B) {
|
||||||
|
cfg := CreateGlobalConfig()
|
||||||
|
allowlist := cfg.Allowlist
|
||||||
|
for n := 0; n < b.N; n++ {
|
||||||
|
for _, cases := range allowlistPathsTests {
|
||||||
|
for _, c := range cases.invalid {
|
||||||
|
allowlist.PathAllowed(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, c := range cases.valid {
|
||||||
|
allowlist.PathAllowed(c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,18 +13,18 @@ func CurlBasicAuth() *config.Rule {
|
|||||||
r := config.Rule{
|
r := config.Rule{
|
||||||
RuleID: "curl-auth-user",
|
RuleID: "curl-auth-user",
|
||||||
Description: "Discovered a potential basic authorization token provided in a curl command, which could compromise the curl accessed resource.",
|
Description: "Discovered a potential basic authorization token provided in a curl command, which could compromise the curl accessed resource.",
|
||||||
Regex: regexp.MustCompile(`\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)(?:=|[ \t]{0,5})(?:"([^:"]{3,}:[^"]{3,})"|'([^:']{3,}:[^']{3,})'|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w${}@.-]+)))(?:\s|\z)`),
|
Regex: regexp.MustCompile(`\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)(?:=|[ \t]{0,5})("(:[^"]{3,}|[^:"]{3,}:|[^:"]{3,}:[^"]{3,})"|'([^:']{3,}:[^']{3,})'|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w${}@.-]+)))(?:\s|\z)`),
|
||||||
Keywords: []string{"curl"},
|
Keywords: []string{"curl"},
|
||||||
Entropy: 2,
|
Entropy: 2,
|
||||||
Allowlists: []config.Allowlist{
|
Allowlists: []config.Allowlist{
|
||||||
{
|
{
|
||||||
Regexes: []*regexp.Regexp{
|
Regexes: []*regexp.Regexp{
|
||||||
regexp.MustCompile(`[^:]+:(change(it|me)|pass(word)?|pwd|test|token|\*+|x+)`), // common placeholder passwords
|
regexp.MustCompile(`[^:]+:(?:change(?:it|me)|pass(?:word)?|pwd|test|token|\*+|x+)`), // common placeholder passwords
|
||||||
regexp.MustCompile(`['"]?<[^>]+>['"]?:['"]?<[^>]+>|<[^:]+:[^>]+>['"]?`), // <placeholder>
|
regexp.MustCompile(`['"]?<[^>]+>['"]?:['"]?<[^>]+>|<[^:]+:[^>]+>['"]?`), // <placeholder>
|
||||||
regexp.MustCompile(`[^:]+:\[[^]]+]`), // [placeholder]
|
regexp.MustCompile(`[^:]+:\[[^]]+]`), // [placeholder]
|
||||||
regexp.MustCompile(`['"]?[^:]+['"]?:['"]?\$(\d|\w+|\{(\d|\w+)})['"]?`), // $1 or $VARIABLE
|
regexp.MustCompile(`['"]?[^:]+['"]?:['"]?\$(?:\d|\w+|\{(?:\d|\w+)})['"]?`), // $1 or $VARIABLE
|
||||||
regexp.MustCompile(`\$\([^)]+\):\$\([^)]+\)`), // $(cat login.txt)
|
regexp.MustCompile(`\$\([^)]+\):\$\([^)]+\)`), // $(cat login.txt)
|
||||||
regexp.MustCompile(`['"]?\$?{{[^}]+}}['"]?:['"]?\$?{{[^}]+}}['"]?`), // ${{ secrets.FOO }} or {{ .Values.foo }}
|
regexp.MustCompile(`['"]?\$?{{[^}]+}}['"]?:['"]?\$?{{[^}]+}}['"]?`), // ${{ secrets.FOO }} or {{ .Values.foo }}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -38,6 +38,8 @@ func CurlBasicAuth() *config.Rule {
|
|||||||
-H 'Content-type: text/plain' \
|
-H 'Content-type: text/plain' \
|
||||||
-d 'world' \
|
-d 'world' \
|
||||||
-u developer:yqDVtkqPECriaLRi`, // different line
|
-u developer:yqDVtkqPECriaLRi`, // different line
|
||||||
|
`curl -u ":d2LkV78zLx!t" https://localhost:9200`, // empty username
|
||||||
|
`curl -u "d2LkV78zLx!t:" https://localhost:9200`, // empty password
|
||||||
|
|
||||||
// long
|
// long
|
||||||
`curl -sw '%{http_code}' -X POST --user 'johns:h0pk1ns~21s' $GItHUB_API_URL/$GIT_COMMIT --data`,
|
`curl -sw '%{http_code}' -X POST --user 'johns:h0pk1ns~21s' $GItHUB_API_URL/$GIT_COMMIT --data`,
|
||||||
@@ -65,6 +67,7 @@ func CurlBasicAuth() *config.Rule {
|
|||||||
`curl -u "${_username}:${_password}"`,
|
`curl -u "${_username}:${_password}"`,
|
||||||
`curl -u "${username}":"${password}"`,
|
`curl -u "${username}":"${password}"`,
|
||||||
`curl -k -X POST -I -u "SRVC_JENKINS:${APPID}"`,
|
`curl -k -X POST -I -u "SRVC_JENKINS:${APPID}"`,
|
||||||
|
`curl -u ":" https://localhost:9200`, // empty username and password
|
||||||
|
|
||||||
// long
|
// long
|
||||||
`curl -sw '%{http_code}' -X POST --user '$USERNAME:$PASSWORD' $GItHUB_API_URL/$GIT_COMMIT --data`,
|
`curl -sw '%{http_code}' -X POST --user '$USERNAME:$PASSWORD' $GItHUB_API_URL/$GIT_COMMIT --data`,
|
||||||
|
|||||||
@@ -49,13 +49,13 @@ func GenericCredential() *config.Rule {
|
|||||||
MatchCondition: config.AllowlistMatchOr,
|
MatchCondition: config.AllowlistMatchOr,
|
||||||
RegexTarget: "match",
|
RegexTarget: "match",
|
||||||
Regexes: []*regexp.Regexp{
|
Regexes: []*regexp.Regexp{
|
||||||
regexp.MustCompile(`(?i)(` +
|
regexp.MustCompile(`(?i)(?:` +
|
||||||
// Access
|
// Access
|
||||||
`access(ibility|or)` +
|
`access(?:ibility|or)` +
|
||||||
`|access[_.-]?id` +
|
`|access[_.-]?id` +
|
||||||
`|random[_.-]?access` +
|
`|random[_.-]?access` +
|
||||||
// API
|
// API
|
||||||
`|api[_.-]?(id|name|version)` + // id/name/version -> not a secret
|
`|api[_.-]?(?:id|name|version)` + // id/name/version -> not a secret
|
||||||
`|rapid|capital` + // common words containing "api"
|
`|rapid|capital` + // common words containing "api"
|
||||||
`|[a-z0-9-]*?api[a-z0-9-]*?:jar:` + // Maven META-INF dependencies that contain "api" in the name.
|
`|[a-z0-9-]*?api[a-z0-9-]*?:jar:` + // Maven META-INF dependencies that contain "api" in the name.
|
||||||
// Auth
|
// Auth
|
||||||
@@ -63,29 +63,29 @@ func GenericCredential() *config.Rule {
|
|||||||
`|X-MS-Exchange-Organization-Auth` + // email header
|
`|X-MS-Exchange-Organization-Auth` + // email header
|
||||||
`|Authentication-Results` + // email header
|
`|Authentication-Results` + // email header
|
||||||
// Credentials
|
// Credentials
|
||||||
`|(credentials?[_.-]?id|withCredentials)` + // Jenkins plugins
|
`|(?:credentials?[_.-]?id|withCredentials)` + // Jenkins plugins
|
||||||
// Key
|
// Key
|
||||||
`|(bucket|foreign|hot|idx|natural|primary|pub(lic)?|schema|sequence)[_.-]?key` +
|
`|(?:bucket|foreign|hot|idx|natural|primary|pub(?:lic)?|schema|sequence)[_.-]?key` +
|
||||||
`|key[_.-]?(alias|board|code|frame|id|length|mesh|name|pair|ring|selector|signature|size|stone|storetype|word|up|down|left|right)` +
|
`|key[_.-]?(?:alias|board|code|frame|id|length|mesh|name|pair|ring|selector|signature|size|stone|storetype|word|up|down|left|right)` +
|
||||||
// Azure KeyVault
|
// Azure KeyVault
|
||||||
`|key[_.-]?vault[_.-]?(id|name)|keyVaultToStoreSecrets` +
|
`|key[_.-]?vault[_.-]?(?:id|name)|keyVaultToStoreSecrets` +
|
||||||
`|key(store|tab)[_.-]?(file|path)` +
|
`|key(?:store|tab)[_.-]?(?:file|path)` +
|
||||||
`|issuerkeyhash` + // part of ssl cert
|
`|issuerkeyhash` + // part of ssl cert
|
||||||
`|(?-i:[DdMm]onkey|[DM]ONKEY)|keying` + // common words containing "key"
|
`|(?-i:[DdMm]onkey|[DM]ONKEY)|keying` + // common words containing "key"
|
||||||
// Secret
|
// Secret
|
||||||
`|(secret)[_.-]?(length|name|size)` + // name of e.g. env variable
|
`|(?:secret)[_.-]?(?:length|name|size)` + // name of e.g. env variable
|
||||||
`|UserSecretsId` + // https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=linux
|
`|UserSecretsId` + // https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=linux
|
||||||
|
|
||||||
// Token
|
// Token
|
||||||
`|(io\.jsonwebtoken[ \t]?:[ \t]?[\w-]+)` + // Maven library coordinats. (e.g., https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt)
|
`|(?:io\.jsonwebtoken[ \t]?:[ \t]?[\w-]+)` + // Maven library coordinats. (e.g., https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt)
|
||||||
|
|
||||||
// General
|
// General
|
||||||
`|(api|credentials|token)[_.-]?(endpoint|ur[il])` +
|
`|(?:api|credentials|token)[_.-]?(?:endpoint|ur[il])` +
|
||||||
`|public[_.-]?token` +
|
`|public[_.-]?token` +
|
||||||
`|(key|token)[_.-]?file` +
|
`|(?:key|token)[_.-]?file` +
|
||||||
// Empty variables capturing the next line (e.g., .env files)
|
// Empty variables capturing the next line (e.g., .env files)
|
||||||
`|(?-i:([A-Z_]+=\n[A-Z_]+=|[a-z_]+=\n[a-z_]+=)(\n|\z))` +
|
`|(?-i:(?:[A-Z_]+=\n[A-Z_]+=|[a-z_]+=\n[a-z_]+=)(?:\n|\z))` +
|
||||||
`|(?-i:([A-Z.]+=\n[A-Z.]+=|[a-z.]+=\n[a-z.]+=)(\n|\z))` +
|
`|(?-i:(?:[A-Z.]+=\n[A-Z.]+=|[a-z.]+=\n[a-z.]+=)(?:\n|\z))` +
|
||||||
`)`),
|
`)`),
|
||||||
},
|
},
|
||||||
StopWords: append(DefaultStopWords,
|
StopWords: append(DefaultStopWords,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ var githubAllowlist = []config.Allowlist{
|
|||||||
{
|
{
|
||||||
Paths: []*regexp.Regexp{
|
Paths: []*regexp.Regexp{
|
||||||
// https://github.com/octokit/auth-token.js/?tab=readme-ov-file#createtokenauthtoken-options
|
// https://github.com/octokit/auth-token.js/?tab=readme-ov-file#createtokenauthtoken-options
|
||||||
regexp.MustCompile(`(^|/)@octokit/auth-token/README\.md$`),
|
regexp.MustCompile(`(?:^|/)@octokit/auth-token/README\.md$`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func KubernetesSecret() *config.Rule {
|
|||||||
// Avoid overreach between directives.
|
// Avoid overreach between directives.
|
||||||
RegexTarget: "match",
|
RegexTarget: "match",
|
||||||
Regexes: []*regexp.Regexp{
|
Regexes: []*regexp.Regexp{
|
||||||
regexp.MustCompile(`(kind:(.|\s)+\n---\n(.|\s)+\bdata:|data:(.|\s)+\n---\n(.|\s)+\bkind:)`),
|
regexp.MustCompile(`(kind:(?:.|\s)+\n---\n(?:.|\s)+\bdata:|data:(?:.|\s)+\n---\n(?:.|\s)+\bkind:)`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
+33
-33
@@ -15,38 +15,38 @@ description = "global allow lists"
|
|||||||
regexes = [
|
regexes = [
|
||||||
'''(?i)^true|false|null$''',
|
'''(?i)^true|false|null$''',
|
||||||
'''^(?i:a+|b+|c+|d+|e+|f+|g+|h+|i+|j+|k+|l+|m+|n+|o+|p+|q+|r+|s+|t+|u+|v+|w+|x+|y+|z+|\*+|\.+)$''',
|
'''^(?i:a+|b+|c+|d+|e+|f+|g+|h+|i+|j+|k+|l+|m+|n+|o+|p+|q+|r+|s+|t+|u+|v+|w+|x+|y+|z+|\*+|\.+)$''',
|
||||||
'''^\$(\d+|{\d+})$''',
|
'''^\$(?:\d+|{\d+})$''',
|
||||||
'''^\$([A-Z_]+|[a-z_]+)$''',
|
'''^\$(?:[A-Z_]+|[a-z_]+)$''',
|
||||||
'''^\${([A-Z_]+|[a-z_]+)}$''',
|
'''^\${(?:[A-Z_]+|[a-z_]+)}$''',
|
||||||
'''^\{\{[ \t]*[\w ().|]+[ \t]*}}$''',
|
'''^\{\{[ \t]*[\w ().|]+[ \t]*}}$''',
|
||||||
'''^\$\{\{[ \t]*((env|github|secrets|vars)(\.[A-Za-z]\w+)+[\w "'&./=|]*)[ \t]*}}$''',
|
'''^\$\{\{[ \t]*(?:(?:env|github|secrets|vars)(?:\.[A-Za-z]\w+)+[\w "'&./=|]*)[ \t]*}}$''',
|
||||||
'''^%([A-Z_]+|[a-z_]+)%$''',
|
'''^%(?:[A-Z_]+|[a-z_]+)%$''',
|
||||||
'''^%[+\-# 0]?[bcdeEfFgGoOpqstTUvxX]$''',
|
'''^%[+\-# 0]?[bcdeEfFgGoOpqstTUvxX]$''',
|
||||||
'''^\{\d{0,2}}$''',
|
'''^\{\d{0,2}}$''',
|
||||||
'''^@([A-Z_]+|[a-z_]+)@$''',
|
'''^@(?:[A-Z_]+|[a-z_]+)@$''',
|
||||||
]
|
]
|
||||||
paths = [
|
paths = [
|
||||||
'''gitleaks\.toml''',
|
'''gitleaks\.toml''',
|
||||||
'''(?i)\.(bmp|gif|jpe?g|svg|tiff?)$''',
|
'''(?i)\.(?:bmp|gif|jpe?g|png|svg|tiff?)$''',
|
||||||
'''\.(eot|[ot]tf|woff2?)$''',
|
'''(?i)\.(?:eot|[ot]tf|woff2?)$''',
|
||||||
'''(.*?)(doc|docx|zip|xls|pdf|bin|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe|gltf)$''',
|
'''(?i)\.(?:docx?|xlsx?|pdf|bin|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe|gltf|zip)$''',
|
||||||
'''go\.(mod|sum|work(\.sum)?)$''',
|
'''go\.(?:mod|sum|work(?:\.sum)?)$''',
|
||||||
'''(^|/)vendor/modules\.txt$''',
|
'''(?:^|/)vendor/modules\.txt$''',
|
||||||
'''(^|/)vendor/(github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)(/.*)?$''',
|
'''(?:^|/)vendor/(?:github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)(?:/.*)?$''',
|
||||||
'''(^|/)gradlew(\.bat)?$''',
|
'''(?:^|/)gradlew(?:\.bat)?$''',
|
||||||
'''(^|/)gradle\.lockfile$''',
|
'''(?:^|/)gradle\.lockfile$''',
|
||||||
'''(^|/)mvnw(\.cmd)?$''',
|
'''(?:^|/)mvnw(?:\.cmd)?$''',
|
||||||
'''(^|/)\.mvn/wrapper/MavenWrapperDownloader\.java$''',
|
'''(?:^|/)\.mvn/wrapper/MavenWrapperDownloader\.java$''',
|
||||||
'''(^|/)node_modules(/.*)?$''',
|
'''(?:^|/)node_modules(?:/.*)?$''',
|
||||||
'''(^|/)(npm-shrinkwrap\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$''',
|
'''(?:^|/)(?:npm-shrinkwrap\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$''',
|
||||||
'''(^|/)bower_components(/.*)?$''',
|
'''(?:^|/)bower_components(?:/.*)?$''',
|
||||||
'''(^|/)(angular|bootstrap|jquery(-?ui)?|plotly|swagger-?ui)[a-zA-Z0-9.-]*(\.min)?\.js(\.map)?$''',
|
'''(?:^|/)(?:angular|bootstrap|jquery(?:-?ui)?|plotly|swagger-?ui)[a-zA-Z0-9.-]*(?:\.min)?\.js(?:\.map)?$''',
|
||||||
'''(^|/)javascript\.json$''',
|
'''(?:^|/)javascript\.json$''',
|
||||||
'''(^|/)(Pipfile|poetry)\.lock$''',
|
'''(?:^|/)(?:Pipfile|poetry)\.lock$''',
|
||||||
'''(?i)/?(v?env|virtualenv)/lib(64)?(/.*)?$''',
|
'''(?i)(?:^|/)(?:v?env|virtualenv)/lib(?:64)?(?:/.*)?$''',
|
||||||
'''(?i)(^|/)(lib(64)?/python[23](\.\d{1,2})+|python/[23](\.\d{1,2})+/lib(64)?)(/.*)?$''',
|
'''(?i)(?:^|/)(?:lib(?:64)?/python[23](?:\.\d{1,2})+|python/[23](?:\.\d{1,2})+/lib(?:64)?)(?:/.*)?$''',
|
||||||
'''(?i)(^|/)[a-z0-9_.]+-[0-9.]+\.dist-info(/.+)?$''',
|
'''(?i)(?:^|/)[a-z0-9_.]+-[0-9.]+\.dist-info(?:/.+)?$''',
|
||||||
'''(^|/)vendor/(bundle|ruby)(/.*?)?$''',
|
'''(?:^|/)vendor/(?:bundle|ruby)(?:/.*?)?$''',
|
||||||
'''\.gem$''',
|
'''\.gem$''',
|
||||||
'''verification-metadata\.xml''',
|
'''verification-metadata\.xml''',
|
||||||
'''Database.refactorlog''',
|
'''Database.refactorlog''',
|
||||||
@@ -293,15 +293,15 @@ keywords = ["curl"]
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
id = "curl-auth-user"
|
id = "curl-auth-user"
|
||||||
description = "Discovered a potential basic authorization token provided in a curl command, which could compromise the curl accessed resource."
|
description = "Discovered a potential basic authorization token provided in a curl command, which could compromise the curl accessed resource."
|
||||||
regex = '''\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)(?:=|[ \t]{0,5})(?:"([^:"]{3,}:[^"]{3,})"|'([^:']{3,}:[^']{3,})'|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w${}@.-]+)))(?:\s|\z)'''
|
regex = '''\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)(?:=|[ \t]{0,5})("(:[^"]{3,}|[^:"]{3,}:|[^:"]{3,}:[^"]{3,})"|'([^:']{3,}:[^']{3,})'|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w${}@.-]+)))(?:\s|\z)'''
|
||||||
entropy = 2
|
entropy = 2
|
||||||
keywords = ["curl"]
|
keywords = ["curl"]
|
||||||
[[rules.allowlists]]
|
[[rules.allowlists]]
|
||||||
regexes = [
|
regexes = [
|
||||||
'''[^:]+:(change(it|me)|pass(word)?|pwd|test|token|\*+|x+)''',
|
'''[^:]+:(?:change(?:it|me)|pass(?:word)?|pwd|test|token|\*+|x+)''',
|
||||||
'''['"]?<[^>]+>['"]?:['"]?<[^>]+>|<[^:]+:[^>]+>['"]?''',
|
'''['"]?<[^>]+>['"]?:['"]?<[^>]+>|<[^:]+:[^>]+>['"]?''',
|
||||||
'''[^:]+:\[[^]]+]''',
|
'''[^:]+:\[[^]]+]''',
|
||||||
'''['"]?[^:]+['"]?:['"]?\$(\d|\w+|\{(\d|\w+)})['"]?''',
|
'''['"]?[^:]+['"]?:['"]?\$(?:\d|\w+|\{(?:\d|\w+)})['"]?''',
|
||||||
'''\$\([^)]+\):\$\([^)]+\)''',
|
'''\$\([^)]+\):\$\([^)]+\)''',
|
||||||
'''['"]?\$?{{[^}]+}}['"]?:['"]?\$?{{[^}]+}}['"]?''',
|
'''['"]?\$?{{[^}]+}}['"]?:['"]?\$?{{[^}]+}}['"]?''',
|
||||||
]
|
]
|
||||||
@@ -586,7 +586,7 @@ regexes = [
|
|||||||
[[rules.allowlists]]
|
[[rules.allowlists]]
|
||||||
regexTarget = "match"
|
regexTarget = "match"
|
||||||
regexes = [
|
regexes = [
|
||||||
'''(?i)(access(ibility|or)|access[_.-]?id|random[_.-]?access|api[_.-]?(id|name|version)|rapid|capital|[a-z0-9-]*?api[a-z0-9-]*?:jar:|author|X-MS-Exchange-Organization-Auth|Authentication-Results|(credentials?[_.-]?id|withCredentials)|(bucket|foreign|hot|idx|natural|primary|pub(lic)?|schema|sequence)[_.-]?key|key[_.-]?(alias|board|code|frame|id|length|mesh|name|pair|ring|selector|signature|size|stone|storetype|word|up|down|left|right)|key[_.-]?vault[_.-]?(id|name)|keyVaultToStoreSecrets|key(store|tab)[_.-]?(file|path)|issuerkeyhash|(?-i:[DdMm]onkey|[DM]ONKEY)|keying|(secret)[_.-]?(length|name|size)|UserSecretsId|(io\.jsonwebtoken[ \t]?:[ \t]?[\w-]+)|(api|credentials|token)[_.-]?(endpoint|ur[il])|public[_.-]?token|(key|token)[_.-]?file|(?-i:([A-Z_]+=\n[A-Z_]+=|[a-z_]+=\n[a-z_]+=)(\n|\z))|(?-i:([A-Z.]+=\n[A-Z.]+=|[a-z.]+=\n[a-z.]+=)(\n|\z)))''',
|
'''(?i)(?:access(?:ibility|or)|access[_.-]?id|random[_.-]?access|api[_.-]?(?:id|name|version)|rapid|capital|[a-z0-9-]*?api[a-z0-9-]*?:jar:|author|X-MS-Exchange-Organization-Auth|Authentication-Results|(?:credentials?[_.-]?id|withCredentials)|(?:bucket|foreign|hot|idx|natural|primary|pub(?:lic)?|schema|sequence)[_.-]?key|key[_.-]?(?:alias|board|code|frame|id|length|mesh|name|pair|ring|selector|signature|size|stone|storetype|word|up|down|left|right)|key[_.-]?vault[_.-]?(?:id|name)|keyVaultToStoreSecrets|key(?:store|tab)[_.-]?(?:file|path)|issuerkeyhash|(?-i:[DdMm]onkey|[DM]ONKEY)|keying|(?:secret)[_.-]?(?:length|name|size)|UserSecretsId|(?:io\.jsonwebtoken[ \t]?:[ \t]?[\w-]+)|(?:api|credentials|token)[_.-]?(?:endpoint|ur[il])|public[_.-]?token|(?:key|token)[_.-]?file|(?-i:(?:[A-Z_]+=\n[A-Z_]+=|[a-z_]+=\n[a-z_]+=)(?:\n|\z))|(?-i:(?:[A-Z.]+=\n[A-Z.]+=|[a-z.]+=\n[a-z.]+=)(?:\n|\z)))''',
|
||||||
]
|
]
|
||||||
stopwords = [
|
stopwords = [
|
||||||
"000000",
|
"000000",
|
||||||
@@ -2084,7 +2084,7 @@ keywords = [
|
|||||||
]
|
]
|
||||||
[[rules.allowlists]]
|
[[rules.allowlists]]
|
||||||
paths = [
|
paths = [
|
||||||
'''(^|/)@octokit/auth-token/README\.md$''',
|
'''(?:^|/)@octokit/auth-token/README\.md$''',
|
||||||
]
|
]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
@@ -2109,7 +2109,7 @@ entropy = 3
|
|||||||
keywords = ["ghp_"]
|
keywords = ["ghp_"]
|
||||||
[[rules.allowlists]]
|
[[rules.allowlists]]
|
||||||
paths = [
|
paths = [
|
||||||
'''(^|/)@octokit/auth-token/README\.md$''',
|
'''(?:^|/)@octokit/auth-token/README\.md$''',
|
||||||
]
|
]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
@@ -2385,7 +2385,7 @@ regexes = [
|
|||||||
[[rules.allowlists]]
|
[[rules.allowlists]]
|
||||||
regexTarget = "match"
|
regexTarget = "match"
|
||||||
regexes = [
|
regexes = [
|
||||||
'''(kind:(.|\s)+\n---\n(.|\s)+\bdata:|data:(.|\s)+\n---\n(.|\s)+\bkind:)''',
|
'''(kind:(?:.|\s)+\n---\n(?:.|\s)+\bdata:|data:(?:.|\s)+\n---\n(?:.|\s)+\bkind:)''',
|
||||||
]
|
]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
|||||||
+8
-1
@@ -158,6 +158,9 @@ func listenForStdErr(stderr io.ReadCloser, errCh chan<- error) {
|
|||||||
// you may want to set your diff.renameLimit variable to at least
|
// you may want to set your diff.renameLimit variable to at least
|
||||||
// (some large number) and retry the command.
|
// (some large number) and retry the command.
|
||||||
//
|
//
|
||||||
|
// Auto packing the repository in background for optimum performance.
|
||||||
|
// See "git help gc" for manual housekeeping.
|
||||||
|
//
|
||||||
// we skip exiting the program as git log -p/git diff will continue
|
// we skip exiting the program as git log -p/git diff will continue
|
||||||
// to send data to stdout and finish executing. This next bit of
|
// to send data to stdout and finish executing. This next bit of
|
||||||
// code prevents gitleaks from stopping mid scan if this error is
|
// code prevents gitleaks from stopping mid scan if this error is
|
||||||
@@ -167,7 +170,11 @@ func listenForStdErr(stderr io.ReadCloser, errCh chan<- error) {
|
|||||||
strings.Contains(scanner.Text(),
|
strings.Contains(scanner.Text(),
|
||||||
"inexact rename detection was skipped") ||
|
"inexact rename detection was skipped") ||
|
||||||
strings.Contains(scanner.Text(),
|
strings.Contains(scanner.Text(),
|
||||||
"you may want to set your diff.renameLimit") {
|
"you may want to set your diff.renameLimit") ||
|
||||||
|
strings.Contains(scanner.Text(),
|
||||||
|
"See \"git help gc\" for manual housekeeping") ||
|
||||||
|
strings.Contains(scanner.Text(),
|
||||||
|
"Auto packing the repository in background for optimum performance") {
|
||||||
logging.Warn().Msg(scanner.Text())
|
logging.Warn().Msg(scanner.Text())
|
||||||
} else {
|
} else {
|
||||||
logging.Error().Msgf("[git] %s", scanner.Text())
|
logging.Error().Msgf("[git] %s", scanner.Text())
|
||||||
|
|||||||
Reference in new issue
Block a user