release 1.18.2: refuse stale mon HTML / box-drawing generator assets

This commit is contained in:
Hernâni Marques 2026-07-19 09:02:55 +02:00
parent 7b3a345b7d
commit 4bdb08bf3c
No known key found for this signature in database
GPG key ID: CB5738652768F7E9
5 changed files with 83 additions and 14 deletions

View file

@ -227,6 +227,25 @@ is_bootstrap_html() {
&& ! grep -qE 'taler-mon:top|id="mon-console"|class="console"' "$f" 2>/dev/null
}
# Stale mon HTML from pre-1.15.8 generators: box-drawing char-class regex in
# sticky filter JS (Python SyntaxWarning: invalid escape sequence '\-').
# Never accept these as "current" public assets (v1.18.2+).
is_stale_generator_html() {
local f="$1"
# Old isLowValue() JS (literal box glyphs + \- class)
if grep -qE 'if \(/\^\[[╔╗╚╝║═]' "$f" 2>/dev/null; then
return 0
fi
# Converter noise teed into old logs and re-rendered
if grep -qiE 'SyntaxWarning: invalid escape sequence' "$f" 2>/dev/null; then
return 0
fi
if grep -qiE 'console_to_html\.py:[0-9]+: SyntaxWarning' "$f" 2>/dev/null; then
return 0
fi
return 1
}
# True if body looks like our monitoring HTML (not merchant API / WP 404 / bootstrap).
is_monitoring_html() {
local f="$1"
@ -475,6 +494,19 @@ check_one() {
return 0
fi
# Stale generator JS / SyntaxWarning in public body (pre-1.15.8 assets)
if is_stale_generator_html "$body"; then
if [ "$attempt" -lt "$max_try" ]; then
attempt=$((attempt + 1))
sleep "$sleep_s" 2>/dev/null || sleep 1
continue
fi
_mon_fail_or_soft "public mon page stale generator" \
"$url -> old mon HTML (box-drawing JS regex and/or SyntaxWarning in body) — re-run host-agent on suite ≥v1.15.8 / v1.18.2; do not leave pre-update assets live" || { rm -f "$body"; return 1; }
rm -f "$body"
return 0
fi
if ! is_monitoring_html "$body"; then
if [ "$attempt" -lt "$max_try" ]; then
attempt=$((attempt + 1))