fix(export): no client names hardcoded in export_public.sh leak check

The leak-check grep pattern no longer contains (obfuscated) client names.
Patterns are now derived at runtime from:
- sibling variant theme folders (../<name>_vanilla, excluding this theme)
- variants/leak-patterns.txt (gitignored; canonical copy in the private
  repo respondage_vanilla_variants)
The export tar also excludes leak-patterns.txt, and the script was verified:
export builds clean, and a planted client string is correctly detected.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-16 20:41:23 +01:00
commit d22abc8745
2 changed files with 27 additions and 3 deletions

3
.gitignore vendored
View file

@ -4,3 +4,6 @@
# variants/build.php at that folder (2nd CLI argument or RESPONDAGE_VARIANTS_DIR). # variants/build.php at that folder (2nd CLI argument or RESPONDAGE_VARIANTS_DIR).
variants/*.json variants/*.json
variants/README.internal.md variants/README.internal.md
# extra leak-check patterns for variants/export_public.sh (client names/terms/colors);
# the canonical copy lives in the private repo respondage_vanilla_variants
variants/leak-patterns.txt

View file

@ -31,12 +31,33 @@ mkdir -p "$STAGE" "$OUT_DIR"
# 1. copy the theme, excluding .git, client variant definitions, the internal # 1. copy the theme, excluding .git, client variant definitions, the internal
# variants README and old exports (the generic build/export scripts are kept) # variants README and old exports (the generic build/export scripts are kept)
(cd "$THEME_DIR" && tar --exclude='./.git' --exclude='./dist' --exclude='./variants/*.json' --exclude='./variants/README.internal.md' -cf - .) | (cd "$STAGE" && tar -xf -) (cd "$THEME_DIR" && tar --exclude='./.git' --exclude='./dist' --exclude='./variants/*.json' --exclude='./variants/README.internal.md' --exclude='./variants/leak-patterns.txt' -cf - .) | (cd "$STAGE" && tar -xf -)
# 2. leak check: no client-identifying strings may remain (text files only). # 2. leak check: no client-identifying strings may remain (text files only).
# The bracket trick keeps this script from matching its own pattern. # Client names are NOT hardcoded in this public file. Patterns are derived:
if grep -rIlE 'eras[m]us|defen[s]ie|rijk[s]logo' "$STAGE"; then # - the names of sibling variant theme folders (../<name>_vanilla next to
# this theme, excluding this theme itself);
# - extra patterns (names, terms, hex colors) from variants/leak-patterns.txt,
# one regex per line. That file is gitignored here and lives in the PRIVATE
# variants repository (respondage_vanilla_variants).
PATTERNS=""
MOTHER_NAME="$(basename "$THEME_DIR")"
for d in "$THEME_DIR"/../*_vanilla; do
[ -d "$d" ] || continue
name="$(basename "$d")"
[ "$name" = "$MOTHER_NAME" ] && continue
PATTERNS="$PATTERNS|$name"
done
if [ -f "$THEME_DIR/variants/leak-patterns.txt" ]; then
while IFS= read -r line; do
case "$line" in ''|\#*) continue ;; esac
PATTERNS="$PATTERNS|$line"
done < "$THEME_DIR/variants/leak-patterns.txt"
fi
PATTERNS="${PATTERNS#|}"
if [ -n "$PATTERNS" ] && grep -rIlE "$PATTERNS" "$STAGE"; then
echo "ERROR: client-identifying strings found in the public export - aborting, staging removed." >&2 echo "ERROR: client-identifying strings found in the public export - aborting, staging removed." >&2
echo "(patterns came from sibling *_vanilla folders and variants/leak-patterns.txt)" >&2
rm -rf "$STAGE" rm -rf "$STAGE"
exit 1 exit 1
fi fi