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

[feat] - Adding StartOffsetProvider Interface and Implementing for Specific Detectors #2956

Closed ahrav closed 3 months ago

ahrav commented 3 months ago

Description:

This PR introduces a new StartOffsetProvider interface to enhance the span calculation strategy for detectors where keywords are not prefixes in the credentials. The adjustableSpanCalculator has been updated to utilize this interface, allowing for more precise control over the start index in match spans. Specific detectors can optionally implement this interface to adjust the start index accordingly.

Checklist:

rgmz commented 3 months ago

I think every MultiPartCredentialProvider necessarily has to have a StartOffset to account for both

username = foo
password = bar

and

password = bar
username = foo