-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add --max-depth=N #110
Comments
Hey @jgowdy, thanks for the feature request -- I'm pretty sure we've already got this. tartufo/tartufo/commands/scan_local_repo.py Lines 11 to 16 in a345eb9
tartufo/tartufo/commands/scan_remote_repo.py Lines 14 to 19 in a345eb9
Lines 23 to 27 in a345eb9
Lines 438 to 440 in a345eb9
Is there more to this that we should be doing? Or is this not working as advertised? |
🤦♂️ I should have looked first. |
I believe the existing --max-depth command should materialize / checkout the Nth commit and scan that checkout plus the 49 newer deltas, rather than only scanning the 50 newest deltas. |
That's an interesting idea. So what you're suggesting is, if I do If so, I think this could use some different naming. I really like the idea, and I think it's a valuable one; but I think that the current |
How about tartufo --from-commit=abcdef1234 ...
tartufo --from-commit=HEAD~50 ...
tartufo --from-commit=v2.0.0a2 ...
# For extra credit (maybe it would be better not to overload the flag this much)
tartufo --from-commit="01 Aug 2020 14:30" ...
tartufo --from-commit="2 weeks ago" ... I purposely suggest At which point, if you can do that much folding, spindling, and mutilating, you might as well go whole-hog and do both
More concretely, if the user says "check the last 50 commits" and backtracking down the commit chain leads you past the merge of two active branches, what does "the last 50 commits" even mean? The 50 most chronologically recent commits? The 50 most recent commits reachable from HEAD? All commits which are 50-degrees-of-Kevin-Bacon-from-HEAD or closer? Something else? Is your answer deterministic? This leaves me thinking that it would be safer to think in terms of chronological boundaries (i.e. starting and/or ending at timestamps) rather than particular commits. That way you can always reason about what you are requesting. Arguably you could have another flag that constrains these further (say to commits on a specified branch, or which are ancestors of a specified commit). However, I wonder if you can implement that without having to scan the entire repo anyway to ensure you didn't miss anything, at which point we've sacrificed the entire motivation for the feature. |
Feature Request
In order to better handle larger repos with a great deal of history, it would be valuable to provide an option to scan up to a certain depth of commits. By checking out / materializing the oldest commit specified, you can then scan the deltas only up to that commit for secrets.
The logic would effectively be:
Walk the git log for the Nth commit back
Checkout the selected commit
Scan the checked out commit and any deltas between the selected commit all the way to HEAD, ignoring commits prior to the selected commit.
tartufo --max-depth=50
The text was updated successfully, but these errors were encountered: