fix(olp-connect): line 547 referenced undefined \$remote_host (bash nounset crash) (#61)

bin/olp-connect declares \$host and \$port locally (line 436) but line 547
referenced an undefined \$remote_host. Under set -u (nounset) the script
aborted with "remote_host: unbound variable" on every successful /health
probe path that surfaced an anonymousKey, blocking the zero-config
client setup that D68-D70 + ADR 0011 designed.

Fix: use \${host}:\${port} (the actual local variables) for the error-log
context. The variable was only used as a message-context string passed
into validate_olp_token, so no behavior change beyond the message.

Discovered while bringing up MacBook as anonymous client of PI231 server
(2026-05-27). Reproduced cleanly on the v0.5.1 main branch.

Co-authored-by: dtzp555 <dtzp555@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dtzp555-max
2026-05-27 12:25:17 +10:00
committed by GitHub
co-authored by taodeng Claude Opus 4.7
parent 9dc070bc53
commit cc250e71bf
+1 -1
View File
@@ -544,7 +544,7 @@ except: print('')" 2>/dev/null || echo "")
# D74 P1-2: validate server-advertised token shape before consuming. # D74 P1-2: validate server-advertised token shape before consuming.
# A hostile or misconfigured server could otherwise inject arbitrary # A hostile or misconfigured server could otherwise inject arbitrary
# strings into the user's rc file via the `anonymousKey` field. # strings into the user's rc file via the `anonymousKey` field.
if ! validate_olp_token "$anon_key" "/health.anonymousKey from $remote_host"; then if ! validate_olp_token "$anon_key" "/health.anonymousKey from ${host}:${port}"; then
log_err "Refusing to consume malformed advertised key. Use --key explicitly or contact the OLP operator." log_err "Refusing to consume malformed advertised key. Use --key explicitly or contact the OLP operator."
exit 2 exit 2
fi fi