Skip to content

Commit 4bb3503

Browse files
exclude file paths (#118)
1 parent 0f5a5ed commit 4bb3503

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
blacklisted_strings: [ ] # skip matches containing any of these strings (case sensitive)
44
blacklisted_extensions: [ ".exe", ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".tif", ".psd", ".xcf", ".zip", ".tar", ".tar.gz", ".ttf", ".lock", ".pem", ".so", ".jar", ".gz" ]
55
blacklisted_paths: [ "{sep}var{sep}lib{sep}docker", "{sep}var{sep}lib{sep}containerd", "{sep}var{sep}lib{sep}containers", "{sep}var{sep}lib{sep}crio", "{sep}var{sep}run{sep}containers", "{sep}bin", "{sep}boot", "{sep}dev", "{sep}lib", "{sep}lib64", "{sep}media", "{sep}proc", "{sep}run", "{sep}sbin", "{sep}usr{sep}lib", "{sep}sys", "{sep}home{sep}kubernetes" ]
6-
exclude_paths: [ "{sep}var{sep}lib{sep}docker", "{sep}var{name_sep}lib{name_sep}docker","{sep}var{sep}lib{sep}containerd", "{sep}var{name_sep}lib{name_sep}containerd", "lost+found" ] # use {sep} for the OS' path seperator and {name_sep} for - (i.e. / or \)
6+
exclude_paths: [ "{sep}var{sep}lib{sep}docker", "{sep}var{name_sep}lib{name_sep}docker","{sep}var{sep}lib{sep}containerd", "{sep}var{name_sep}lib{name_sep}containerd", "lost+found", "{sep}bin", "{sep}boot", "{sep}dev", "{sep}lib", "{sep}lib64", "{sep}media", "{sep}proc", "{sep}run", "{sep}sbin", "{sep}usr{sep}lib", "{sep}sys", "{sep}home{sep}kubernetes" ] # use {sep} for the OS' path seperator and {name_sep} for - (i.e. / or \)
77

88

99
signatures:

scan/process_image.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ func ScanSecretsInDir(layer string, baseDir string, fullDir string,
173173

174174
walkErr := filepath.WalkDir(fullDir, func(path string, f os.DirEntry, err error) error {
175175
if err != nil {
176+
log.Debugf("Error in filepath.Walk: %s", err)
176177
return err
177178
}
178179

@@ -231,6 +232,8 @@ func ScanSecretsInDir(layer string, baseDir string, fullDir string,
231232
}
232233
}
233234

235+
log.Debugf("attempting scanFile on: %+v, relPath: %s", file, relPath)
236+
234237
secrets, err := scanFile(file.Path, relPath, file.Filename, file.Extension, layer, &numSecrets, matchedRuleSet)
235238
if err != nil {
236239
log.Infof("relPath: %s, Filename: %s, Extension: %s, layer: %s", relPath, file.Filename, file.Extension, layer)
@@ -244,6 +247,8 @@ func ScanSecretsInDir(layer string, baseDir string, fullDir string,
244247
secrets = signature.MatchSimpleSignatures(relPath, file.Filename, file.Extension, layer, &numSecrets)
245248
secretsFound = append(secretsFound, secrets...)
246249

250+
log.Debugf("scan completed for file: %+v, numSecrets: %d", file, numSecrets)
251+
247252
// Don't report secrets if number of secrets exceeds MAX value
248253
if numSecrets >= *session.Options.MaxSecrets {
249254
return maxSecretsExceeded

0 commit comments

Comments
 (0)