Files
Bolke de Bruin 980c6266c0 Bind cached tunnel reuse to the original session identity
HandleGatewayProtocol caches a *Tunnel keyed on the client-supplied
Rdg-Connection-Id header so the two halves of a session (RDG_OUT_DATA
and RDG_IN_DATA) can rendezvous on a single record. The cache hit path
previously reused the tunnel without checking who was making the
follow-up request.

Add tunnelOwnerMatches(t, id) to compare the cached tunnel's
UserName() and AttrClientIp against the request identity. On
mismatch, refuse with 401 instead of attaching the new request to the
existing tunnel. The helper is conservative: nil tunnel/user/identity,
empty username, or missing client-IP attribute all fail closed.

The legitimate case (the same client returns to attach its second
half-channel to its own first half) is unchanged.

Adds TestTunnelOwnershipEnforced.
2026-04-30 14:04:15 +02:00
..