Implement scanning logic in the gem
Problem to solve
Implement the core functionality of the gem. At a very high level, when this Issue is done, we will be able to take a blob, scan it against a set of patterns, and return any matches. Beyond the tasks listed in the implementation plan below, further efforts to mitigate potential performance problems (e.g. max blob size, run time limit, etc.) will be handled in other Issues.
Implementation plan
Add the following scanning logic to the gem:
- Interface that accepts a blob object and a timeout
- Load up and compile a list of patterns (the exact/initial list of patterns will be decided in this issue)
-
Consider using the keywords provided in Gitleaks' rules to a quick first scan (source)Moved to separate issue that is targeted for Beta, but can be moved up if time allows. - Run the blob against the patterns (use RE2 gem)
Return the scan as soon as a secret is found in a blob, stopping the push, and returning an error message- The scan will find all secrets in the supplied blob, stopping the push when any secrets are found, and returning an error message
Testing
- Add automated tests
- Manual testing by integrating the gem with either the previous POC, or the work in Create a push check to run secrets detection sc... (&11613 - closed), depending on how it is progressing to ensure we're on the right track.
Resources
Edited by rossfuhrman