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

fixed #16 Refactored duroc_hog to avoid output file #18

Closed nicolasjhampton closed 4 years ago

nicolasjhampton commented 4 years ago

This PR is duplicated in PR #19

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.

Testing

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

cutler-scott-newrelic commented 4 years ago

I think this commit conflicts / overlaps with the other. I tested the other and it seems to work and meets the intention of this request so I'll close it.