Description
The detector unit tests were created by "reverse engineering" the patterns, thus they do not provide any real value or confirm how accurate the detectors are.
Additionally, the structure of the tests are (in my opinion) not maintainable as they are difficult to understand and do not reflect any realistic scenarios.
trufflehog/pkg/detectors/netsuite/netsuite_test.go
Lines 14 to 44 in def734a
Examples
There are dozens, if not hundreds, of problematic test files. These are illustrative.
BombBomb
The "valid" tests for BombBomb do not match the detector's pattern.
Kraken
The "valid" pattern is nonsensical and not correct base64 encoding. The detector should not match this, that is a defect.
https://support.kraken.com/hc/en-us/articles/360000919966-How-to-create-an-API-key
viewneo
A few hundred detectors contain tests tightly coupled to the current implementation of PrefixRegex
. Any changes to the prefix pattern will break the detector tests, which seems inadvisable.
trufflehog/pkg/detectors/viewneo/viewneo_test.go
Lines 38 to 42 in def734a