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:
parent
c0a8ea7b30
commit
c07a0542eb
5 changed files with 51 additions and 12 deletions
|
|
@ -155,12 +155,17 @@ python3 - <<'PY'
|
||||||
import json
|
import json
|
||||||
d=json.load(open("/tmp/wd.json"))
|
d=json.load(open("/tmp/wd.json"))
|
||||||
print("wd_keys", list(d.keys())[:20])
|
print("wd_keys", list(d.keys())[:20])
|
||||||
|
import re
|
||||||
uri=d.get("taler_withdraw_uri") or d.get("withdrawal_uri") or ""
|
uri=d.get("taler_withdraw_uri") or d.get("withdrawal_uri") or ""
|
||||||
wid=d.get("withdrawal_id") or d.get("id") or ""
|
wid=d.get("withdrawal_id") or d.get("id") or ""
|
||||||
if not uri:
|
if not uri:
|
||||||
for v in d.values():
|
for v in d.values():
|
||||||
if isinstance(v, str) and v.startswith("taler"):
|
if isinstance(v, str) and v.startswith("taler"):
|
||||||
uri=v
|
uri=v
|
||||||
|
uri=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)", r"\1\2", uri or "", flags=re.I)
|
||||||
|
uri=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)", r"\1\2", uri or "", flags=re.I)
|
||||||
|
for a,b in ((":443/","/"),(":443?","?"),(":80/","/"),(":80?","?")):
|
||||||
|
uri=uri.replace(a,b)
|
||||||
open("/tmp/bench-wuri.txt","w").write(uri)
|
open("/tmp/bench-wuri.txt","w").write(uri)
|
||||||
open("/tmp/bench-wid.txt","w").write(wid)
|
open("/tmp/bench-wid.txt","w").write(wid)
|
||||||
print("WURI", uri)
|
print("WURI", uri)
|
||||||
|
|
|
||||||
|
|
@ -43,24 +43,36 @@ def public_webui_url() -> str:
|
||||||
|
|
||||||
|
|
||||||
def normalize_taler_withdraw_uri(uri: str) -> 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 /
|
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.
|
iOS wallets then fail host parsing or TLS. Path and id stay unchanged.
|
||||||
|
Applies to withdraw, pay, pay-template, etc.
|
||||||
"""
|
"""
|
||||||
if not uri:
|
if not uri:
|
||||||
return uri
|
return uri
|
||||||
# taler://withdraw/bank.example:443/taler-integration/UUID
|
# taler://SCHEME/host:443/... or :80
|
||||||
uri = re.sub(
|
uri = re.sub(
|
||||||
r"(taler://withdraw/)([^/?#]+):443(?=/|$)",
|
r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)",
|
||||||
r"\1\2",
|
r"\1\2",
|
||||||
uri,
|
uri,
|
||||||
|
flags=re.I,
|
||||||
)
|
)
|
||||||
uri = re.sub(
|
uri = re.sub(
|
||||||
r"(taler://withdraw/)([^/?#]+):80(?=/|$)",
|
r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)",
|
||||||
r"\1\2",
|
r"\1\2",
|
||||||
uri,
|
uri,
|
||||||
|
flags=re.I,
|
||||||
)
|
)
|
||||||
|
for a, b in (
|
||||||
|
(":443/", "/"),
|
||||||
|
(":443?", "?"),
|
||||||
|
(":443#", "#"),
|
||||||
|
(":80/", "/"),
|
||||||
|
(":80?", "?"),
|
||||||
|
(":80#", "#"),
|
||||||
|
):
|
||||||
|
uri = uri.replace(a, b)
|
||||||
return uri
|
return uri
|
||||||
|
|
||||||
def load_pass() -> str:
|
def load_pass() -> str:
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,10 @@
|
||||||
# 3) wallet-cli: ToS + accept-uri + run-until-done each rung
|
# 3) wallet-cli: ToS + accept-uri + run-until-done each rung
|
||||||
# 4) amounts from atomic-GOA up until bank/wallet fails
|
# 4) amounts from atomic-GOA up until bank/wallet fails
|
||||||
#
|
#
|
||||||
# Prefer the monitoring phase (random increasing ranges + timings + report):
|
# Prefer the monitoring amount ladder (modular wd + pay):
|
||||||
# ../taler-monitoring/taler-monitoring.sh ladder
|
# cd ~/src/taler-monitoring && ./taler-monitoring.sh -d hacktivism.ch ladder
|
||||||
# LADDER_MAX_RUNGS=10 ../taler-monitoring/check_goa_ladder.sh
|
# ./taler-monitoring.sh max-ladder # highest withdrawable + payable
|
||||||
|
# LADDER_STEPS=10 LADDER_PAY=0 ./taler-monitoring.sh ladder
|
||||||
#
|
#
|
||||||
# Usage (standalone, fixed ladder):
|
# Usage (standalone, fixed ladder):
|
||||||
# ./goa-withdraw-ladder.sh
|
# ./goa-withdraw-ladder.sh
|
||||||
|
|
@ -53,7 +54,7 @@ wcli() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Default ladder via Python: fixed 0 + random low picks + random high ranges + fixed max.
|
# 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() {
|
default_amounts() {
|
||||||
python3 - <<'PY'
|
python3 - <<'PY'
|
||||||
import math, random
|
import math, random
|
||||||
|
|
@ -235,7 +236,15 @@ for amt in "${LADDER[@]}"; do
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
WID=$(echo "$WD" | python3 -c 'import json,sys; print(json.load(sys.stdin).get("withdrawal_id",""))')
|
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" ] || {
|
[ -n "$WID" ] && [ -n "$URI" ] || {
|
||||||
log "FAIL parse mint: $WD"
|
log "FAIL parse mint: $WD"
|
||||||
echo -e "${n}\t${amt}\tFAIL_PARSE\t-\t" >>"$RESULTS"
|
echo -e "${n}\t${amt}\tFAIL_PARSE\t-\t" >>"$RESULTS"
|
||||||
|
|
|
||||||
|
|
@ -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')
|
WID=$(printf '%s' "$WD" | sed -n 's/.*"withdrawal_id"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
|
||||||
[ -n "$URI" ] || { echo "no URI from: $WD" >&2; exit 1; }
|
[ -n "$URI" ] || { echo "no URI from: $WD" >&2; exit 1; }
|
||||||
[ -n "$WID" ] || WID=$(basename "$URI")
|
[ -n "$WID" ] || WID=$(basename "$URI")
|
||||||
# libeufin emits host:443 — strip default HTTPS port for wallet apps
|
# libeufin emits host:443 — strip default HTTPS/HTTP ports for wallet apps
|
||||||
URI=$(printf '%s' "$URI" | sed -E 's|(taler://withdraw/[^/:]+):443(/)|\1\2|; s|(taler://withdraw/[^/:]+):443$|\1|')
|
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"
|
mkdir -p "$LANDING_DIR"
|
||||||
printf '%s\n' "$URI" >"$LANDING_DIR/withdraw.uri"
|
printf '%s\n' "$URI" >"$LANDING_DIR/withdraw.uri"
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,12 @@ python3 - <<'PY'
|
||||||
import json
|
import json
|
||||||
d=json.load(open("/tmp/wd-create.json"))
|
d=json.load(open("/tmp/wd-create.json"))
|
||||||
wid=d.get("withdrawal_id") or d.get("id")
|
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("WID", wid)
|
||||||
print("WURI", uri)
|
print("WURI", uri)
|
||||||
open("/tmp/wid.txt","w").write(wid or "")
|
open("/tmp/wid.txt","w").write(wid or "")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue