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:
Rafael FigueiredoandRafael Figueiredo authored and GitHub committed 2023-03-21 08:50:34 -05:00
1 parent a5b9c24779
commit 9701bf1724
55 files changed
+195 -1

No files matched your search

+6 -1
View File
@@ -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 {