feat(git,github): add --since date filter to git and github scans#4822
Open
sapasapasapa wants to merge 3 commits intotrufflesecurity:mainfrom
Open
feat(git,github): add --since date filter to git and github scans#4822sapasapasapa wants to merge 3 commits intotrufflesecurity:mainfrom
sapasapasapa wants to merge 3 commits intotrufflesecurity:mainfrom
Conversation
Add a `--since <date>` flag to both the `git` and `github` subcommands to limit scanning to commits more recent than the specified date. The date is passed as `--after=<date>` to `git log` via the existing `additionalArgs` variadic in `gitparse.RepoPath`. Add a `--max-depth <n>` flag to the `github` subcommand to mirror the existing flag on the `git` subcommand, capping the number of commits scanned per repository. Changes: - pkg/sources/git/scan_options.go: add SinceDate field and ScanOptionSinceDate option func - pkg/sources/git/git.go: pass SinceDate as --after arg to RepoPath; expose ApplyScanOption for post-Init augmentation - pkg/sources/sources.go: add SinceDate to GitConfig and GithubConfig; add MaxDepth to GithubConfig - pkg/engine/git.go: apply SinceDate scan option after source Init - pkg/engine/github.go: apply MaxDepth and SinceDate scan options - main.go: wire --since and --max-depth flags for git and github subcommands Co-Authored-By: Claude <noreply@anthropic.com>
The --max-depth flag for GitHub scans was added but never active. Only the --since date filter is the intended new feature. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description:
Add a
--since <date>flag to thegitandgithubsubcommands to limit scanning to commits more recent than the specified date (e.g.2024-01-01).Internally, the date is passed as
--after=<date>togit logvia the existing variadicadditionalArgsingitparse.RepoPath. This allows incremental scans where only recent history needs to be checked, avoiding re-scanning the full commit history on each run.Files changed
pkg/sources/git/scan_options.goSinceDatefield andScanOptionSinceDateoption funcpkg/sources/git/git.goSinceDateas--afterarg toRepoPath; exposeApplyScanOptionfor post-Initaugmentationpkg/sources/sources.goSinceDatetoGitConfigandGithubConfigpkg/engine/git.goSinceDatescan option after sourceInitpkg/engine/github.goSinceDatescan optionmain.go--sinceflag forgitandgithubsubcommandsChecklist:
make test-community)?make lintthis requires golangci-lint)?Note
Low Risk
Low risk: additive CLI/config plumbing that only narrows the
git logcommit range via--after, with minimal impact outside git/github scan paths.Overview
Adds a new
--since <date>flag to thegitandgithubsubcommands and threads it throughsources.GitConfig/sources.GithubConfiginto git scanning.When set, git-based scans now pass
--after=<date>intogit log(viagitparse.Parser.RepoPathadditional args) to restrict scanning to commits newer than the provided date; the git source also gainsScanOptions.SinceDateplus anApplyScanOptionhelper to augment options post-Init.Written by Cursor Bugbot for commit 5f1081a. This will update automatically on new commits. Configure here.