From 3b454a18b2f599837b75b5efc2b3d826cea1ff5a Mon Sep 17 00:00:00 2001 From: bntvllnt <32437578+bntvllnt@users.noreply.github.com> Date: Sat, 31 Oct 2026 00:18:06 +0100 Subject: [PATCH 1/2] fix(privacy): validate denylist patterns with the scanning regex engine GNU grep -E accepts PCRE syntax such as (?i), (?:...) and lookarounds that git grep -E rejects, so a secret pattern using it passed validation and then failed the scan as an opaque 'git grep failed'. Validate denylist patterns with git grep itself so the error names the pattern index and never prints the pattern. Allowlist patterns keep GNU grep validation because grep applies them. --- CHANGELOG.md | 2 ++ scripts/privacy-denylist.sh | 32 ++++++++++++++++++++++++-------- scripts/test-privacy-denylist.sh | 9 +++++++++ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d32859..3d09c3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Validate `Privacy Guard` denylist patterns with `git grep -E`, the engine that scans, so PCRE-only syntax such as `(?i)` or `(?:...)` fails by pattern index instead of an opaque `git grep failed`. + - Add a `Privacy Guard` workflow: gitleaks over full history plus a structural denylist check with an allowlist, optional private patterns, and withheld match content. ## 0.1.0-canary.6 diff --git a/scripts/privacy-denylist.sh b/scripts/privacy-denylist.sh index d9d2e5d..b06831a 100755 --- a/scripts/privacy-denylist.sh +++ b/scripts/privacy-denylist.sh @@ -33,18 +33,34 @@ patterns="$(mktemp)" allow_patterns="$(mktemp)" hits="$(mktemp)" kept="$(mktemp)" -trap 'rm -f "$tracked" "$extra" "$patterns" "$allow_patterns" "$hits" "$kept"' EXIT +probe_dir="$(mktemp -d)" +trap 'rm -rf "$tracked" "$extra" "$patterns" "$allow_patterns" "$hits" "$kept" "$probe_dir"' EXIT +printf '\n' > "$probe_dir/empty.txt" +printf 'a b\n' > "$probe_dir/text.txt" strip() { sed -E '/^[[:space:]]*(#|$)/d'; } # lines : the file with a guaranteed final newline. lines() { cat "$1"; printf '\n'; } -# valid_regexes