fix: strip taler:// default :443/:80 in bank mint consumers

Align demo-withdraw-api, goa-withdraw-ladder, refresh-demo-withdraw,
amount-ladder bench, and extreme tests with mon normalize rules so
libeufin host:443 never reaches wallets or QR payloads.
This commit is contained in:
Hernâni Marques 2026-07-19 15:38:34 +02:00
parent 947c72e595
commit dc94b30fed
No known key found for this signature in database
5 changed files with 51 additions and 12 deletions

View file

@ -43,24 +43,36 @@ def public_webui_url() -> str:
def normalize_taler_withdraw_uri(uri: str) -> str:
"""Strip default :443/:80 from taler://withdraw host (wallet base-URL fix).
"""Strip default :443/:80 from any taler:// authority (wallet base-URL fix).
libeufin builds authority from https BASE_URL and includes port 443; Android /
iOS wallets then fail host parsing or TLS. Path and id stay unchanged.
Applies to withdraw, pay, pay-template, etc.
"""
if not uri:
return uri
# taler://withdraw/bank.example:443/taler-integration/UUID
# taler://SCHEME/host:443/... or :80
uri = re.sub(
r"(taler://withdraw/)([^/?#]+):443(?=/|$)",
r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)",
r"\1\2",
uri,
flags=re.I,
)
uri = re.sub(
r"(taler://withdraw/)([^/?#]+):80(?=/|$)",
r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)",
r"\1\2",
uri,
flags=re.I,
)
for a, b in (
(":443/", "/"),
(":443?", "?"),
(":443#", "#"),
(":80/", "/"),
(":80?", "?"),
(":80#", "#"),
):
uri = uri.replace(a, b)
return uri
def load_pass() -> str:

View file

@ -7,9 +7,10 @@
# 3) wallet-cli: ToS + accept-uri + run-until-done each rung
# 4) amounts from atomic-GOA up until bank/wallet fails
#
# Prefer the monitoring phase (random increasing ranges + timings + report):
# ../taler-monitoring/taler-monitoring.sh ladder
# LADDER_MAX_RUNGS=10 ../taler-monitoring/check_goa_ladder.sh
# Prefer the monitoring amount ladder (modular wd + pay):
# cd ~/src/taler-monitoring && ./taler-monitoring.sh -d hacktivism.ch ladder
# ./taler-monitoring.sh max-ladder # highest withdrawable + payable
# LADDER_STEPS=10 LADDER_PAY=0 ./taler-monitoring.sh ladder
#
# Usage (standalone, fixed ladder):
# ./goa-withdraw-ladder.sh
@ -53,7 +54,7 @@ wcli() {
}
# Default ladder via Python: fixed 0 + random low picks + random high ranges + fixed max.
# Prefer taler-monitoring check_goa_ladder.sh for full control (LADDER_* env).
# Prefer taler-monitoring check_amount_ladder.sh (+ ladder/lib_pay.sh) for LADDER_* env.
default_amounts() {
python3 - <<'PY'
import math, random
@ -235,7 +236,15 @@ for amt in "${LADDER[@]}"; do
break
fi
WID=$(echo "$WD" | python3 -c 'import json,sys; print(json.load(sys.stdin).get("withdrawal_id",""))')
URI=$(echo "$WD" | python3 -c 'import json,sys; u=json.load(sys.stdin).get("taler_withdraw_uri",""); print(u.replace(":443/","/"))')
URI=$(echo "$WD" | python3 -c '
import json, re, sys
u = json.load(sys.stdin).get("taler_withdraw_uri") or ""
u = re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)", r"\1\2", u, flags=re.I)
u = re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)", r"\1\2", u, flags=re.I)
for a, b in ((":443/", "/"), (":443?", "?"), (":80/", "/"), (":80?", "?")):
u = u.replace(a, b)
print(u)
')
[ -n "$WID" ] && [ -n "$URI" ] || {
log "FAIL parse mint: $WD"
echo -e "${n}\t${amt}\tFAIL_PARSE\t-\t" >>"$RESULTS"

View file

@ -38,8 +38,16 @@ URI=$(printf '%s' "$WD" | sed -n 's/.*"taler_withdraw_uri"[[:space:]]*:[[:space:
WID=$(printf '%s' "$WD" | sed -n 's/.*"withdrawal_id"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
[ -n "$URI" ] || { echo "no URI from: $WD" >&2; exit 1; }
[ -n "$WID" ] || WID=$(basename "$URI")
# libeufin emits host:443 — strip default HTTPS port for wallet apps
URI=$(printf '%s' "$URI" | sed -E 's|(taler://withdraw/[^/:]+):443(/)|\1\2|; s|(taler://withdraw/[^/:]+):443$|\1|')
# libeufin emits host:443 — strip default HTTPS/HTTP ports for wallet apps
URI=$(printf '%s' "$URI" | python3 -c '
import re,sys
u=sys.stdin.read().strip()
u=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)", r"\1\2", u, flags=re.I)
u=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)", r"\1\2", u, flags=re.I)
for a,b in ((":443/","/"),(":443?","?"),(":80/","/"),(":80?","?")):
u=u.replace(a,b)
print(u)
')
mkdir -p "$LANDING_DIR"
printf '%s\n' "$URI" >"$LANDING_DIR/withdraw.uri"

View file

@ -188,7 +188,12 @@ python3 - <<'PY'
import json
d=json.load(open("/tmp/wd-create.json"))
wid=d.get("withdrawal_id") or d.get("id")
uri=d.get("taler_withdraw_uri")
uri=d.get("taler_withdraw_uri") or ""
import re
uri=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)", r"\1\2", uri, flags=re.I)
uri=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)", r"\1\2", uri, flags=re.I)
for a,b in ((":443/","/"),(":443?","?"),(":80/","/"),(":80?","?")):
uri=uri.replace(a,b)
print("WID", wid)
print("WURI", uri)
open("/tmp/wid.txt","w").write(wid or "")