Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presence of 'line of code' values are inconsistently presented in results, depending upon the data source configured #2504

Open
0x736E opened this issue Feb 24, 2024 · 0 comments
Labels

Comments

@0x736E
Copy link

0x736E commented Feb 24, 2024

Please review the Community Note before submitting

TruffleHog Version

v3.4.3 to present

Trace Output

N/A

Expected Behavior

If a data source supports 'line of code', then the line of code value should be calculated and reported in results regardless of which data source is selected (e.g. filesystem, git).

Actual Behavior

The line of code value is not consistently reported in results, depending upon which data source is used.

When scanning with the 'git' data source, the line of code values are present for all findings, however when scanning with the 'filesystem' data source, line of code values are missing for approximately 50% (5 out of 10) samples.

This behaviour appears to be dependant upon the custom detector's regular expression pattern configured. An explicit pattern which returns the same raw secret type for each finding, returns line of code values (albeit inaccurately) for most, whereas a slightly more broad pattern did not produce any line numbers when using the filesystem data source.

Steps to Reproduce

  1. Create a file with multiple instances (at least two) of the exact same secret, one after another. The secret must contain the exact same value, and type.
  2. Scan the file with TruffleHog configured with 'git' data source
  3. Scan the file with TruffleHog configured with 'fileystem' data source, against the same file
  4. The results will not consistently have line of code values present

Environment

  • OS: All
  • Version: v3.68.0

Additional Context

This behaviour was identified while analysing the root cause of #2502 and was noticed that changing data sources produce results which are inconsistent with one another. There is more documentation on that issue, and sample files which produce the inconsistent output and their results here:

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant