* Add opt-in SSH credential proxying
* fix(sshproxy): drop sshpiper fork, authorize only verified keys
Rebuild the SSH listener on stock golang.org/x/crypto/ssh:
- authorization, secret fetch, and upstream login run in
VerifiedPublicKeyCallback, after the client proves key possession
- typed default-deny channel/request policy; refusals no longer drop
the connection
- auth decisions and session requests emit the shared JSON/OTEL audit
entries (mode ssh) with rejected_by and grant annotations
- upstream dials use the proxy-wide upstream_deny_cidrs guard
* fix(sshproxy): interrupt upstream SSH handshake on cancellation
ssh.NewClientConn ignores context, so shutdown or revocation during the
upstream login waited for the handshake deadline.
* test(sshproxy): port SSH proxy tests from #298
Adapt the stacked test suite to the stock x/crypto implementation:
exec/SFTP, revocation, wstunnel v11 and TLS identity, keepalives under
load, handshake deadlines and cancellation, grant validation, and config
loading. Packet-hook policy tests are replaced by a typed policy table.
Co-authored-by: Jonathan Goodwin <jonathan.goodwin@klaviyo.com>
* fix(sshproxy): satisfy errcheck on Close calls
* fix(sshproxy): detect dead peers, relay EOF, classify authorizer outages
- probe both peers with keepalive@openssh.com and end the session after
three silent intervals, so a dropped client cannot hold upstream open
- relay upstream EOF once stdout and stderr drain, before channel close
- treat only 401/403 from the authorizer as denials; other statuses are
audited as errors
- drain upstream requests when the downstream channel accept fails
---------
Co-authored-by: Jonathan Goodwin <jonathan.goodwin@klaviyo.com>
Every secrets transform, credential source, and config reload builds its
own source registry, and each registry had its own 1Password client cache.
The 1Password SDK loads its Wasm core lazily without synchronization, so
concurrent first fetches from different registries each compiled a separate
copy of the core (~150 MB RSS apiece). Twenty requests needing three
1Password-backed secrets peaked at ~470 MB.
Use a single process-wide client cache so SDK client creation is serialized
and the core is loaded once.
* fix(postgres): reject callback-binding definitions such as CREATE AGGREGATE
* test(postgres): cover aggregate alias and harden fixture grants
* test(postgres): keep fixture privileges default so tests exercise the proxy
The expirable LRU uses Go monotonic time, which does not advance while the
host is suspended. Certificate validity uses wall-clock time, so a cached
leaf could remain in the LRU after its NotAfter timestamp had passed and be
served to clients as expired.
Check the cached leaf NotAfter timestamp before reuse. Remove and regenerate
the entry when its certificate has expired, and add a regression test for the
stale-cache case.
In MITM mode the leaf certificate advertised no ALPN protocols and the
HTTPS/tunnel listeners served only HTTP/1.1. gRPC clients (grpc-go >=1.67
enforces ALPN) therefore failed the TLS handshake with "missing selected ALPN
property", the upstream transport never negotiated h2, and response trailers
were dropped so a gRPC status never reached the client.
- Advertise h2 (and http/1.1) via ALPN on both MITM tls.Configs (the direct
HTTPS listener and the CONNECT-tunnel leaf) and register net/http's HTTP/2
server so h2-negotiated connections are served by the existing handler.
- Set ForceAttemptHTTP2 on the upstream transport so h2-capable upstreams
negotiate h2, while HTTP/1.1 upstreams keep working via fallback.
- Forward upstream response trailers to the client via http.TrailerPrefix, as
net/http/httputil's ReverseProxy does for trailers found after the headers.
net/http abstracts HTTP/1.1 and HTTP/2 behind the same http.Request, so the
transform pipeline (allowlist, secret injection, header allowlist, etc.) applies
unchanged.
Adds integration coverage for both MITM listeners: TestIntegration_CONNECT_HTTP2
(CONNECT tunnel) and TestIntegration_DirectHTTPS_HTTP2 (direct HTTPS), each
asserting ALPN h2 on both hops and trailer propagation.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
serveOneHTTPConn returned as soon as a handler hijacked the connection
(StateHijacked closes the one-conn listener), which let callers' deferred
conn.Close() calls tear down the connection while the WebSocket relay was
still running. Wait for the hijacking handler to finish before returning,
and add regression tests for WebSocket upgrades through CONNECT and SOCKS5
tunnels plus the hijack-lifetime contract itself.