From 70da266863f4b7df102fec32a46953fc127c43a9 Mon Sep 17 00:00:00 2001 From: Christopher Albert Date: Tue, 10 Nov 2026 22:21:53 +0100 Subject: [PATCH] Name the secret findings that block a commit --- scripts/repo_hygiene.py | 2 +- tests/test_repo_hygiene.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/repo_hygiene.py b/scripts/repo_hygiene.py index 1c8693b..adde985 100755 --- a/scripts/repo_hygiene.py +++ b/scripts/repo_hygiene.py @@ -210,7 +210,7 @@ def check(staged, base, head, repository=None, upstream=()): config = Path(tmp) / 'gitleaks.toml' config.write_text('[extend]\nuseDefault = true\n') args = ['gitleaks', 'protect' if staged else 'detect', '--no-banner', - '--redact', '--log-level=error', '--config', str(config), + '--redact', '--verbose', '--log-level=error', '--config', str(config), '--gitleaks-ignore-path', os.devnull, '--ignore-gitleaks-allow'] args += ['--staged'] if staged else [ '--log-opts', ' '.join([f'{base}..{head}', *upstream_exclusion(upstream)])] diff --git a/tests/test_repo_hygiene.py b/tests/test_repo_hygiene.py index 21e8761..405513e 100644 --- a/tests/test_repo_hygiene.py +++ b/tests/test_repo_hygiene.py @@ -160,6 +160,9 @@ def test_local_allowance_never_waives_secrets(self): self.local_allow().write_text('runs/**\tLocal scratch output\n') result = self.gate() self.assertEqual(result.returncode, 1) # gitleaks still runs and blocks + output = result.stdout + result.stderr + self.assertIn('runs/notes.txt', output) # the blocked finding is named + self.assertNotIn(token, output) # but its secret is redacted def test_local_allowance_rejects_identities_and_absolute_paths(self): self.add('runs/output.npz')