trufflesecurity / trufflehog

Find, verify, and analyze leaked credentials
https://trufflesecurity.com
GNU Affero General Public License v3.0
15.83k stars 1.65k forks source link

Return match/reason from `detectors.IsKnownFalsePositive` #2969

Closed rgmz closed 3 months ago

rgmz commented 3 months ago

Description:

Recently, there have been several confusing bugs related to false-positive filtering. In each case, determining the cause of this has required manually adding print statements in order to see why.

2643 added a log statement when a result is filtered, however, it doesn't include the reason why.

This updates the method to include the specific match/reason behind it returning true.

Checklist:

ahrav commented 3 months ago

thanks for this! it looks good to me but i want to give @ahrav an opportunity to hold this merge off until he's done fiddling with all the engine code he was planning to fiddle with

I think we can go ahead and merge this. I'll adjust my PR to deal with the merge conflicts, it shouldn't be too bad. Thanks @rgmz