From d22abc8745da4530a53f4eed4669e47e450b4964 Mon Sep 17 00:00:00 2001 From: Tammo ter Hark Date: Mon, 16 Nov 2026 20:41:23 +0100 Subject: [PATCH] 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 (../_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 --- .gitignore | 3 +++ variants/export_public.sh | 27 ++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b299d56..bffefec 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ # variants/build.php at that folder (2nd CLI argument or RESPONDAGE_VARIANTS_DIR). variants/*.json 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 diff --git a/variants/export_public.sh b/variants/export_public.sh index cd07961..e8832f7 100644 --- a/variants/export_public.sh +++ b/variants/export_public.sh @@ -31,12 +31,33 @@ mkdir -p "$STAGE" "$OUT_DIR" # 1. copy the theme, excluding .git, client variant definitions, the internal # 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). -# The bracket trick keeps this script from matching its own pattern. -if grep -rIlE 'eras[m]us|defen[s]ie|rijk[s]logo' "$STAGE"; then +# Client names are NOT hardcoded in this public file. Patterns are derived: +# - the names of sibling variant theme folders (../_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 "(patterns came from sibling *_vanilla folders and variants/leak-patterns.txt)" >&2 rm -rf "$STAGE" exit 1 fi