Skip to content

[BUG] Detect secrets does not apply exclude lines filter from baseline file #132

@cguest97

Description

@cguest97

Describe the bug
Detect secrets does not seem to be applying the filter set by .exclude.lines found in the baseline file. This leads to findings appearing which should be caught by this rule. Setting the value through the CLI flag --exclude-lines behaves as expected and the findings are filtered out.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new empty folder
  2. Create a file containing the line secret: mysecret
  3. Run detect secrets as follows: detect-secrets scan --update .secrets.baseline --exclude-lines "secret" --all-files
  4. View the baseline file, no results should be found and the value of .exclude.lines should equal "secret:"
  5. Run detect secrets again as follows: detect-secrets scan --update .secrets.baseline --all-files
  6. Reload the baseline file and observe that results is no longer empty

Expected behavior
After running detect-secrets with the --exclude-lines flag, running the scan again without this flag should result in the same baseline file being generated.

Screenshots
image
image
image

Impact
This prevents us using the tool in CI as our production repo contains too many findings to audit by hand without being able to exclude specific keywords from the scan.

Additional context:

  • OS: Windows 11 Enterprise (Version 10.0.22621 Build 22621), Ubuntu 22.04.02 LTSR
  • Python Version: 3.11.2
  • Detect Secrets Version: 0.13.1+ibm.61.dss
  • Languages Scanned: .txt, .go, .yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions