Skip to content
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

--shallow-since for git and github scans #628

Open
chr-b opened this issue Jun 21, 2022 · 3 comments
Open

--shallow-since for git and github scans #628

chr-b opened this issue Jun 21, 2022 · 3 comments

Comments

@chr-b
Copy link

chr-b commented Jun 21, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Scanning of git repositories with a long history can take hours. The --max-depth and --since-commit flags that are available for the git sub command allow to restrict the git history to be scanned.
However, these parameters are not that useful when trying to only scan git history up to a specific point in time. The since-commit flag can be correlated with time, but is AFAIK restricted to a particular branch.

Problem to be Addressed

It would be useful to scan all commits of a git branch up to a particular point in time. E.g. last 24 hours or last 5 days. This will scan all commits across all branches from NOW backwards for the specified time range (or to the specified point in time).

git itself has the --shallow-since parameter that creates a shallow clone with a history after the specified time.

Description of the Preferred Solution

An additional flag --shallow-since (or something named similar) that allows the user to specify a date range, or a specific date in the past. Trufflehog will then scan all commits within the specified date range and will abort once an older commit outside this date range is encountered.

This flag should be available for both the git and github sub commands.

@dustin-decker
Copy link
Contributor

Related, but isn't doing a shallow clone yet: #1631

@svennergr
Copy link

@dustin-decker not sure if I misunderstood it, but isn't trufflehog already using --shallow-since for git clones:
https://github.com/trufflesecurity/trufflehog/blob/main/pkg/sources/git/git.go#L812-L818

@svennergr
Copy link

#564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants