Guard the Go server's request boundary: loopback Host, no Origin on /connect, shared token
The server answered any Host, so a DNS-rebinding page reached /connect (101) and could drive terminals. Every route now refuses a non-loopback Host on a loopback connection (421), /connect refuses any Origin (403), and a server started with -token-file requires X-Pipelines-Token (401; /mcp and /healthz exempt). The CLI/TUI send the token only to loopback URLs.
This commit is contained in:
@@ -19,7 +19,12 @@ import (
|
||||
func Dial(ctx context.Context, url string) (*websocket.Conn, error) {
|
||||
// O(1) exact string compare; only an explicit, validated Docker transport
|
||||
// alias for this same endpoint is ever rewritten.
|
||||
conn, _, err := websocket.Dial(ctx, transportTarget(url), nil)
|
||||
target := transportTarget(url)
|
||||
options, err := dialOptions(target)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
conn, _, err := websocket.Dial(ctx, target, options)
|
||||
if err == nil {
|
||||
conn.SetReadLimit(8 << 20)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user