diff --git a/README.md b/README.md index ad4052b..563fbdb 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,9 @@ The `--hide` flag can be used multiple times to hide sensitive data, it supports `# support-collector --hide "Secret:.*" --hide "Password:.*"` +In addition, files and folders that follow a specific pattern are not collected. This affects all files that correspond to the following filters: +`.*`, `*~`, `*.key`, `*.csr`, `*.crt`, and `*.pem` + By default, we collect all we can find. You can control this by only enabling certain modules, or disabling some. If you want to see what is collected, add `--verbose` diff --git a/internal/collection/collection.go b/internal/collection/collection.go index 7666e18..d6467c2 100644 --- a/internal/collection/collection.go +++ b/internal/collection/collection.go @@ -183,13 +183,7 @@ func (c *Collection) AddFilesIfFound(prefix string, sources ...string) { return } - c.Log.Debug("Collecting files from ", source) - - for _, file := range files { - foundFiles++ - - _ = c.AddFileToOutput(file) - } + c.AddFiles(prefix, source) } if foundFiles == 0 { diff --git a/internal/collection/file.go b/internal/collection/file.go index 3d0742f..e50fff6 100644 --- a/internal/collection/file.go +++ b/internal/collection/file.go @@ -20,7 +20,7 @@ type File struct { io.Writer } -var reIgnoreFiles = regexp.MustCompile(`(^\.|~$)`) +var reIgnoreFiles = regexp.MustCompile(`(^\.|~$|\.key$|\.csr$|\.crt$|\.pem$)`) func NewFile(name string) *File { return &File{ @@ -56,7 +56,9 @@ func LoadFiles(prefix, source string) (files []*File, err error) { return } - files = append(files, file) + if !reIgnoreFiles.MatchString(file.Name) { + files = append(files, file) + } return }