mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
Decode Base64 (#1488)
* Support base64 decoding during scans rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Add failing tests for the case when the match starts outside the decoded value * Align locations for overlapping, encoded matches rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Add --max-decode-depth flag and update README help output rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Move keywords off of fragment rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Fix comment typo rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Refactor how keywords are used in detect rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Clarify comments and rename method to match rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Improve performance rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Fix issues after rebase Only adjust matchIndex to fix the following line issue when not working with encoded segments since they handle adjusting the index themselves. rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Update detect/decoder.go Don't escape characters that don't need escaping Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com> * Update flag help text rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED * Add meta data tags from decoding rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED --------- Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
This commit is contained in:
1 parent
c5b15c9d74
commit
2278a2a97e
8 files changed
+712
-47
No files matched your search
@@ -56,6 +56,7 @@ func init() {
|
||||
rootCmd.PersistentFlags().Bool("no-banner", false, "suppress banner")
|
||||
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().Int("max-decode-depth", 0, "allow recursive decoding up to this depth (default \"0\", no decoding is done)")
|
||||
err := viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config"))
|
||||
if err != nil {
|
||||
log.Fatal().Msgf("err binding config %s", err.Error())
|
||||
@@ -170,6 +171,11 @@ func Detector(cmd *cobra.Command, cfg config.Config, source string) *detect.Dete
|
||||
|
||||
// Setup common detector
|
||||
detector := detect.NewDetector(cfg)
|
||||
|
||||
if detector.MaxDecodeDepth, err = cmd.Flags().GetInt("max-decode-depth"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
|
||||
// set color flag at first
|
||||
if detector.NoColor, err = cmd.Flags().GetBool("no-color"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
|
||||
Reference in new issue
Block a user