GitGuardian / ggshield

Find and fix 400+ types of hardcoded secrets and 70+ types of infrastructure-as-code misconfigurations.
https://gitguardian.com
MIT License
1.62k stars 143 forks source link

Implement pre-commit framework SKIP environment variable. #794

Closed irgeek closed 9 months ago

irgeek commented 10 months ago

When ggshield is configured via the pre-commit framework the user has the option to skip specific scans by setting the SKIP environment variable. When ggshield is configured directly as a git pre-commit hook, though, the user only has the option to disable all pre-commit hooks via the --no-verify command-line option. Here we're "borrowing" the pre-commit framework's option so ggshield can be skipped the same way regardless of how it's configured.

codecov-commenter commented 10 months ago

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (7da1d68) 91.89% compared to head (a655394) 91.91%. Report is 20 commits behind head on main.

Files Patch % Lines
ggshield/cmd/iac/scan/precommit.py 33.33% 2 Missing :warning:
ggshield/cmd/iac/scan/prepush.py 66.66% 1 Missing :warning:
ggshield/cmd/sca/scan/precommit.py 66.66% 1 Missing :warning:
ggshield/cmd/sca/scan/prepush.py 66.66% 1 Missing :warning:
ggshield/cmd/secret/scan/prepush.py 66.66% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #794 +/- ## ========================================== + Coverage 91.89% 91.91% +0.02% ========================================== Files 154 157 +3 Lines 6454 6583 +129 ========================================== + Hits 5931 6051 +120 - Misses 523 532 +9 ``` | [Flag](https://app.codecov.io/gh/GitGuardian/ggshield/pull/794/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GitGuardian) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/GitGuardian/ggshield/pull/794/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GitGuardian) | `91.91% <80.00%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GitGuardian#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

irgeek commented 10 months ago

@agateau-gg I've relocated my first implementation into a hooks module. Before I go scribbling in other files to add the check, can you just confirm this looks OK?

agateau-gg commented 9 months ago

As you pointed out, the lint check fails because the PR comes from a fork of the repository. Therefore I am merging it. Will look into that lint bug later.

StanislasGG commented 9 months ago

Hello Aurelien, can you confirm that this will be included in next week's release ?

Thanks in advance

agateau-gg commented 9 months ago

Hello Aurelien, can you confirm that this will be included in next week's release ?

Thanks in advance

Yes, it will be there.