mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 21:44:23 +01:00
sample config opt
This commit is contained in:
1 parent
55218fc8f8
commit
ce603c73b4
3 files changed
+18
-2
No files matched your search
@@ -1,6 +1,11 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
1.8.0
|
||||||
|
-----
|
||||||
|
- whitelist repos
|
||||||
|
- sample config option
|
||||||
|
|
||||||
1.7.3
|
1.7.3
|
||||||
-----
|
-----
|
||||||
- style points
|
- style points
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ Application Options:
|
|||||||
--csv report output to csv
|
--csv report output to csv
|
||||||
--redact redact secrets from log messages and report
|
--redact redact secrets from log messages and report
|
||||||
--version version number
|
--version version number
|
||||||
|
--sample-config prints a sample config file
|
||||||
|
|
||||||
Help Options:
|
Help Options:
|
||||||
-h, --help Show this help message
|
-h, --help Show this help message
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ type Options struct {
|
|||||||
CSV bool `long:"csv" description:"report output to csv"`
|
CSV bool `long:"csv" description:"report output to csv"`
|
||||||
Redact bool `long:"redact" description:"redact secrets from log messages and report"`
|
Redact bool `long:"redact" description:"redact secrets from log messages and report"`
|
||||||
Version bool `long:"version" description:"version number"`
|
Version bool `long:"version" description:"version number"`
|
||||||
|
SampleConfig bool `long:"sample-config" description:"prints a sample config file"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config struct for regexes matching and whitelisting
|
// Config struct for regexes matching and whitelisting
|
||||||
@@ -122,10 +123,16 @@ type gitDiff struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultGithubURL = "https://api.github.com/"
|
const defaultGithubURL = "https://api.github.com/"
|
||||||
const version = "1.7.3"
|
const version = "1.8.0"
|
||||||
const errExit = 2
|
const errExit = 2
|
||||||
const leakExit = 1
|
const leakExit = 1
|
||||||
const defaultConfig = `
|
const defaultConfig = `
|
||||||
|
# This is a sample config file for gitleaks. You can configure gitleaks what to search for and what to whitelist.
|
||||||
|
# The output you are seeing here is the default gitleaks config. If GITLEAKS_CONFIG environment variable
|
||||||
|
# is set, gitleaks will load configurations from that path. If option --config-path is set, gitleaks will load
|
||||||
|
# configurations from that path. Gitleaks does not whitelist anything by default.
|
||||||
|
|
||||||
|
|
||||||
title = "gitleaks config"
|
title = "gitleaks config"
|
||||||
# add regexes to the regex table
|
# add regexes to the regex table
|
||||||
[[regexes]]
|
[[regexes]]
|
||||||
@@ -151,7 +158,6 @@ description = "Twitter"
|
|||||||
regex = '''(?i)twitter.*['\"][0-9a-zA-Z]{35,44}['\"]'''
|
regex = '''(?i)twitter.*['\"][0-9a-zA-Z]{35,44}['\"]'''
|
||||||
|
|
||||||
[whitelist]
|
[whitelist]
|
||||||
|
|
||||||
#regexes = [
|
#regexes = [
|
||||||
# "AKAIMYFAKEAWKKEY",
|
# "AKAIMYFAKEAWKKEY",
|
||||||
#]
|
#]
|
||||||
@@ -202,6 +208,10 @@ func main() {
|
|||||||
fmt.Println(version)
|
fmt.Println(version)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
if opts.SampleConfig {
|
||||||
|
fmt.Println(defaultConfig)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
leaks, err := run()
|
leaks, err := run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
|
|||||||
Reference in new issue
Block a user