From 5f7a702a34a18a6a69570d295e2712eabb72c9d9 Mon Sep 17 00:00:00 2001 From: Adnan Zahir Date: Mon, 16 Nov 2026 20:55:56 +0700 Subject: [PATCH] fix: avoid self-matching and version-pin false positives in the export checks Co-Authored-By: Claude Sonnet 5.5 --- scripts/export-public.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/export-public.sh b/scripts/export-public.sh index d555962..5cc9820 100755 --- a/scripts/export-public.sh +++ b/scripts/export-public.sh @@ -10,7 +10,7 @@ # Pass --allow-unchecked only if you knowingly want to skip that check. # # Independently of the terms file, a given terms file also enables two pattern checks on the export: personal -# e-mail addresses (anything that is not a documentation/placeholder address) and "@senkensha"-style hosts. +# e-mail addresses (anything that is not a documentation/placeholder address) and organisation-specific hosts. set -euo pipefail allow_unchecked=0 @@ -61,7 +61,7 @@ if [ -n "$terms" ] && [ -f "$terms" ] && grep -q '[^[:space:]]' "$terms"; then fail=1 fi # 2. personal e-mail addresses: any address that is not a documentation or no-reply placeholder - email='[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+' + email='[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}' placeholder='@(example\.(com|org|net|invalid)|[A-Za-z0-9.-]*\.(example|invalid|test|localhost)|users\.noreply\.github\.com|noreply\.[A-Za-z0-9.-]+)$|:(noreply|no-reply)@' if hits="$(grep -rIoE "$email" "$out" --exclude-dir=node_modules --exclude=Cargo.lock --exclude=package-lock.json \ | grep -vE "$placeholder" || true)"; [ -n "$hits" ]; then @@ -69,8 +69,9 @@ if [ -n "$terms" ] && [ -f "$terms" ] && grep -q '[^[:space:]]' "$terms"; then echo "$hits" | sort -u >&2 fail=1 fi - # 3. "@senkensha"-style hosts (any host label containing the org name after an @ or in a URL) - if hits="$(grep -rIiEl '@[A-Za-z0-9.-]*senkensha|https?://[A-Za-z0-9.-]*senkensha' "$out" --exclude-dir=node_modules || true)"; [ -n "$hits" ]; then + # 3. organisation-specific hosts (any host label containing the org name after an @ or in a URL) + org="sen""kensha" # split so that this script does not match itself + if hits="$(grep -rIiEl "@[A-Za-z0-9.-]*$org|https?://[A-Za-z0-9.-]*$org" "$out" --exclude-dir=node_modules || true)"; [ -n "$hits" ]; then echo "organisation-specific hosts found in:" >&2 echo "$hits" >&2 fail=1