fix(app): harden guarded preview proxy
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# F5 preview server candidate review
|
||||
|
||||
Candidate `e3a82b0`'s static preview route was retained, with stricter decoded
|
||||
path validation and canonical-path checks for files and SPA fallback. The proxy
|
||||
now uses `http.request` / `https.request` streams so Range, HEAD, content-encoding,
|
||||
and exact response bytes are preserved. Authentication checks fail closed after
|
||||
five seconds and discard their response bodies. Unauthenticated document GETs
|
||||
are redirected to the authenticated proxy's `/login?next=...`; assets remain
|
||||
401. Login, logout, and artifact proxying still use the browser's upstream cookie.
|
||||
|
||||
WebSocket upgrades validate `/connect` and a same-origin browser Origin before
|
||||
authentication or upstream connection. After authentication, both Host and
|
||||
Origin map to the configured HTTP(S) upstream origin; cookies and upgrade headers
|
||||
are retained. Upgraded sockets are tracked and destroyed during `close()`. HTTPS
|
||||
uses Node TLS verification (no certificate bypass). Bind to loopback by default.
|
||||
|
||||
Verification: `node --test test/tool/preview.test.mjs`, `node --check` on server
|
||||
and test, and `git diff --check`. Tests use only local fixtures and cover login
|
||||
redirect, denied auth, exact compressed Range/HEAD bytes, origin rejection,
|
||||
authenticated bidirectional WebSocket bytes, timeout, shutdown, and traversal / symlink
|
||||
protection. No browser run, Flutter build, production access, or deployment was done.
|
||||
Reference in New Issue
Block a user