chore: import upstream snapshot with attribution
gitleaks / gitleaks (push) Has been skipped
Test / test (ubuntu-latest) (push) Failing after 0s
Test / test (windows-latest) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:12:29 +08:00
commit 48b3ccf279
454 changed files with 32865 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
"""Helper script to be used as a pre-commit hook."""
import os
import sys
import subprocess
def gitleaksEnabled():
"""Determine if the pre-commit hook for gitleaks is enabled."""
out = subprocess.getoutput("git config --bool hooks.gitleaks")
if out == "false":
return False
return True
if gitleaksEnabled():
exitCode = os.WEXITSTATUS(os.system('gitleaks protect -v --staged'))
if exitCode == 1:
print('''Warning: gitleaks has detected sensitive information in your changes.
To disable the gitleaks precommit hook run the following command:
git config hooks.gitleaks false
''')
sys.exit(1)
else:
print('gitleaks precommit disabled\
(enable with `git config hooks.gitleaks true`)')