Skip to content

Commit bcc1424

Browse files
committed
fix(hygiene): allowlist 3 hygiene docs + sync pre-commit hook (P0-3 S2-S4)
1 parent 3f282b2 commit bcc1424

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.husky/pre-commit

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ fi
5353

5454
# Public-repo hygiene content check — flag dangerous flags / unsafe shortcuts
5555
# (Markdown docs included — these strings should never appear in published docs)
56-
HYGIENE_CONTENT_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -v -E '(\.gitleaks\.toml$|\.husky/|\.github/workflows/|docs/exec-plans/)' || true)
56+
# Allowlist must mirror scripts/validate/public_repo_hygiene.py CONTENT_RULES
57+
# allowlist_paths: files that legitimately describe the rule by literal name.
58+
HYGIENE_CONTENT_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -v -E '(\.gitleaks\.toml$|\.husky/|\.github/workflows/|docs/exec-plans/|^tests/.*\.(py|yaml|yml)$|^scripts/validate/public_repo_hygiene\.py$|^docs/internal-docs\.md$|^docs/public-repo-policy\.md$|^docs/security/hygiene-verify\.md$)' || true)
5759
if [ -n "$HYGIENE_CONTENT_FILES" ]; then
5860
HYGIENE_MATCHES=$(echo "$HYGIENE_CONTENT_FILES" | while IFS= read -r f; do grep -nEH 'dangerously-skip-permissions' "$f" 2>/dev/null; done || true)
5961
if [ -n "$HYGIENE_MATCHES" ]; then

scripts/validate/public_repo_hygiene.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ class Rule:
8282
re.compile(r"^\.husky/"),
8383
re.compile(r"^\.github/workflows/"),
8484
re.compile(r"^scripts/validate/public_repo_hygiene\.py$"),
85+
# Hygiene docs that legitimately describe the rule by literal name.
86+
re.compile(r"^docs/internal-docs\.md$"),
87+
re.compile(r"^docs/public-repo-policy\.md$"),
88+
re.compile(r"^docs/security/hygiene-verify\.md$"),
8589
),
8690
),
8791
)

0 commit comments

Comments
 (0)