Dashboard › opencode-lore › Server access, binding, and bounded shu…
01a09194-26e0-7e64-b381-e5b022945df7Authorize management and data-plane requests from the numeric node:http socket peer before CORS, imports, body reads, authentication, storage, or upstream calls; never trust Host, Origin, Forwarded, or X-Forwarded-For as peer identity. Non-loopback peers get bodyless 404s unless remote management is enabled, which additionally requires exact normalized Host/port matching and rejects loopback browser Origins. Apply this to startServer(), upgrades, /, /api, and /ui. Warn visibly when an explicitly configured host is skipped for EADDRNOTAVAIL/EADDRNOTFOUND; continue only if another host binds. For shutdown, track every socket through close, then use deadline-driven closeIdleConnections(), closeAllConnections(), and explicit destruction because partial headers and upgraded sockets can outlive server.close(). Keep closure bounded and idempotent.