mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
Bufix/1100 protect stagged files (#1121)
* create repo with stagged secrets * add .gitleaksignore to testdata repo * fix typo * add gitleaksignore to detector on protect command --------- Co-authored-by: Rafael Figueiredo <rfigueiredo@garoa.cloud>
This commit is contained in:
1 parent
a5b9c24779
commit
9701bf1724
55 files changed
+195
-1
No files matched your search
+6
-1
@@ -66,11 +66,16 @@ func runProtect(cmd *cobra.Command, args []string) {
|
||||
if detector.Redact, err = cmd.Flags().GetBool("redact"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
|
||||
if detector.MaxTargetMegaBytes, err = cmd.Flags().GetInt("max-target-megabytes"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
|
||||
if fileExists(filepath.Join(source, ".gitleaksignore")) {
|
||||
if err = detector.AddGitleaksIgnore(filepath.Join(source, ".gitleaksignore")); err != nil {
|
||||
log.Fatal().Err(err).Msg("could not call AddGitleaksIgnore")
|
||||
}
|
||||
}
|
||||
|
||||
// get log options for git scan
|
||||
logOpts, err := cmd.Flags().GetString("log-opts")
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user