-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
Scan only PR commits for Gitleaks instead of whole codebase #2487
Comments
That could be doable here -> https://github.com/oxsecurity/megalinter/blob/main/megalinter/linters/GitleaksLinter.py Before the call to if config.get("VALIDATE_ALL_CODEBASE", "true") == "false":
self.cli_lint_extra_args += ['--log-opts', '--no-merges', '--first-parent', '${{ github.event.pull_request.base.sha }}^..${{ github.event.pull_request.head.sha }}'] (GitHub Actions variables should be replaced by appropriate ENV vars.) Would you like to make a PR ? :) |
@nvuillam but we have to take into account other CI like Azure Pipelines, in the linter script we can't hardcode those variables that only exist in GitHub. |
@bdovaz indeed :) |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
wip #2504 |
Is your feature request related to a problem? Please describe.
Scan only PR commits for Gitleaks instead of whole codebase, when
VALIDATE_ALL_CODEBASE
is set tofalse
Describe the solution you'd like
When
VALIDATE_ALL_CODEBASE
is set tofalse
, and megalinter runs on PR then Gitleaks scans only PR commits.Describe alternatives you've considered
Described scenarios is achievable by passing
REPOSITORY_GITLEAKS_ARGUMENTS
env contains gitleaks flag--log-opts
, but nice to have out-of-the-box support (usingVALIDATE_ALL_CODEBASE
) without extra configuration.Downside - to scan only PR commits with proposed gitleaks config, git checkout has to be set with
fetch-depth: 0
Additional context
N/A
The text was updated successfully, but these errors were encountered: