Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: git plugin - option to limit depth of historical scans (#118)
Closes #94 - add the `depth` field to the `GitPlugin` struct - add the `depth` option to the git plugin command - create a function called `buildScanOptions` to generate a string of scanning options for the _gitleaks_ `GitLog` function - by default, _gitleaks_ `GitLog` function scans using `--full-history` and `--all` options (see: https://github.com/gitleaks/gitleaks/blob/master/detect/git/git.go#L44). The reason these options are embedded in `buildScanOptions` is to maintain this behavior - tested manually **Proposed Changes** - feat: add `--depth <number>` option to git plugin command **Additional Considerations** - `GitLog` `--all` option scans the entire repo (including all branches). users may prefer to scan only a specific branch instead of the entire repository. - Not directly related, but the current behavior of the git plugin is to skip deleted files (https://github.com/Checkmarx/2ms/blob/master/plugins/git.go#L48). In case there is an unnoticed leak in a deleted file, the secret will still exist in the git history and will be missed. I submit this contribution under the Apache-2.0 license. --------- Co-authored-by: Jossef Harush Kadouri <[email protected]> Co-authored-by: Baruch Odem (Rothkoff) <[email protected]> Co-authored-by: Baruch Odem (Rothkoff) <[email protected]>
- Loading branch information