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

Fix our pre-receive docker sample #819

Closed agateau-gg closed 8 months ago

agateau-gg commented 8 months ago

Description

Our sample script to run GGShield as pre-receive via Docker does not work. This is because pre-receive commits are kept in a "quarantine" environment (see https://git-scm.com/docs/git-receive-pack#_quarantine_environment), git sets some environment variables before running the pre-receive hook so that git commands run by the hook can find the quarantined commits.

Furthermore, since these environment variables contain absolute path to directories, the path to the git checkout inside the Docker container must be the same as the path on the host.

What has been done