Skip to content

Matched Strings can be used as signatures #398

Open
@mgaspar-godaddy

Description

@mgaspar-godaddy

🐛 Bug Report

In a tartufo.toml file a matched_string value can be used as a signature and tartufo will accept and exclude that value when scanning.

This appears to be a side effect from here:

tartufo/tartufo/scanner.py

Lines 424 to 425 in c750412

blob
in self.excluded_signatures # Signatures themselves pop up as entropy matches

Those lines of code appear to be intended to ignore signatures from entropy checks, but the resulting outcome is if a matched_string is excluded as a signature (instead of using the signature value) tartufo will still exclude it.

To Reproduce

Take a repo with an item flagged by tartufo. Copy the matched_string value and add it to the tartufo.toml as a signature. For example, if I am getting a match on the string -----BEGIN RSA PRIVATE KEY----- I can do the following to exclude it:

exclude-signatures = [
  { signature = '-----BEGIN RSA PRIVATE KEY-----', reason = 'exclude signature' }
]

Expected Behavior

This should not result in excluding the matched_string. I would expect tartufo to throw an error indicating one of the signatures to exclude is not a valid signature.

Code Example

See the code example under To Reproduce.

Environment

tartufo, version 3.2.1
Python 3.9.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions