You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: follow the redirect only as an http->https upgrade (Copilot review)
An already-https LZ_HOST_URL that answers with a redirect (e.g.
canonicalization) must not re-enter the upgrade path - on a loopback
host it would grant the -k cert-skip to a probe that never needed
upgrading. A non-http:// base now refuses the redirect loudly (rc 2)
with a warn telling the operator to set LZ_HOST_URL to the URL the
server expects.
Harness: new always-redirect mock mode + 3 assertions; 18/18 at HEAD;
the two behavioral assertions fail against the pre-fix commit (the -k
retry fired, no refusal warn).
Copy file name to clipboardExpand all lines: install.sh
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,17 @@ validate_token() {
141
141
fi
142
142
case"$_PROBE_HTTP"in
143
143
301|302|307|308)
144
+
# Follow the redirect ONLY as an HTTP->HTTPS upgrade. An already-https
145
+
# base that redirects (e.g. canonicalization) must NOT re-enter this
146
+
# path - it could grant the loopback cert-skip to a probe that never
147
+
# needed upgrading. It falls through to the non-200 fail-loud below.
148
+
case"$base"in
149
+
http://*) : ;;
150
+
*)
151
+
warn "the LZ API at ${base} answered HTTP ${_PROBE_HTTP} (a redirect); refusing to follow it from a non-http:// base - set LZ_HOST_URL to the URL the server expects"
152
+
return 2
153
+
;;
154
+
esac
144
155
# Strip trailing slashes BEFORE the :80 strip, or a trailing slash
145
156
# shields the port ('localhost:80/' must become 'localhost', not
146
157
# 'localhost:80' - retrying https against the plaintext port always
0 commit comments