newrelic / rusty-hog

A suite of secret scanners built in Rust for performance. Based on TruffleHog (https://github.com/dxa4481/truffleHog) which is written in Python.
Apache License 2.0
445 stars 58 forks source link

Add whitelist to duroc hog #19

Closed nicolasjhampton closed 4 years ago

nicolasjhampton commented 4 years ago

Fixes #15 Fixes #16

What

This PR adds an output_file argument to the private scan_dir function in duroc_hog, and refactors the scan_dir function to repeat less code and separate directory iteration approaches from file scanning, resulting in less repeating code.

By filtering the files in the scanned directory, these changes avoid scanning duroc_hog's output file, avoiding false finds after repeated runs.

This PR also adds a whitelist option to duroc_hog by using the SecretScanner's is_whitelisted method inside the scan_file and scan_bytes functions

Testing

Integration tests for duroc_hog have been included. The binary build does slow the tests down somewhat, and escargot has been included as a dev-dependency.