Compare commits

...

26 commits

Author SHA1 Message Date
Matthew Slipper
3d96ce8dd2
feat(sshproxy): add opt-in SSH credential proxying on stock x/crypto (#300)
* 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>
2026-11-04 13:54:48 -07:00
Matthew Slipper
f374500020
Revert "Add opt-in SSH credential proxying (#297)" (#301)
This reverts commit 6eee95bfa4.
2026-11-04 13:53:46 -07:00
goodwin-klaviyo
6eee95bfa4
Add opt-in SSH credential proxying (#297) 2026-11-04 13:52:12 -07:00
Matthew Slipper
fd1c8bc735
fix(secrets): share one 1Password client across all sources (#299)
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.
2026-10-30 22:29:27 -06:00
Matthew Slipper
60ed3566e5
fix: require patched Go toolchain for emudhra CA compromise (#288)
* fix: block compromised emudhra CA chains in proxy images

* refactor: rely on Go's emudhra certificate rejection

* test: remove redundant emudhra verifier fixtures

* docs: remove emudhra README addition
2026-10-21 06:03:54 -06:00
Leonardo Yvens
7c6a6e9261
fix WS hang (#244) 2026-10-16 13:37:33 -06:00
Matthew Slipper
5bb325ace6 fix(postgres): harden managed-session statement policy (#275)
* 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
2026-10-06 12:33:26 -06:00
Matthew Slipper
b345f88756
fix(postgres): reject writes to pg_settings (#274)
Harden the postgres policy by rejecting UPDATE and INSERT on pg_settings,
along with view and rule definitions that reference it.
2026-10-06 11:45:21 -06:00
Matthew Slipper
8a0eb0beb6
fix: inspect postgres routine definitions (#267)
* fix: inspect postgres routine definitions

* docs: describe postgres routine inspection
2026-09-28 23:05:43 -06:00
Matthew Slipper
8bffd32664
fix: bound postgres frontend messages (#266)
* fix: bound postgres frontend messages

* docs: document postgres message limit
2026-09-28 22:16:00 -06:00
Matthew Slipper
4002e146fe
fix: harden postgres RLS function handling (#265)
* fix: harden postgres function call policy

* docs: describe postgres function restrictions
2026-09-28 22:01:43 -06:00
Matthew Slipper
5bd11abeb9
build(deps): consolidate Dependabot updates (#255)
* build(deps): consolidate Go dependency updates

* build(deps): consolidate GitHub Actions updates

* build(deps): update example Go images
2026-09-18 09:39:28 -06:00
ahhahahahahah
cf95726ca0
fix(hostmatch): case-insensitive domain glob matching per RFC 4343 and IPv6 bracket stripping in StripPort (#229) 2026-09-18 09:35:14 -06:00
0xferrous
aa37229e89
fix: regenerate expired cached certificates (#235)
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.
2026-09-18 09:34:30 -06:00
dependabot[bot]
92b48cdad6
build(deps): bump google.golang.org/grpc from 1.81.1 to 1.83.0 (#225)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.81.1 to 1.83.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.81.1...v1.83.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-version: 1.83.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-18 09:31:19 -06:00
dependabot[bot]
5b29ffd183
build(deps): bump golang.org/x/net from 0.55.0 to 0.58.0 (#226)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.55.0 to 0.58.0.
- [Commits](https://github.com/golang/net/compare/v0.55.0...v0.58.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.57.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-18 09:29:21 -06:00
dependabot[bot]
7cbd642d40
build(deps): bump actions/checkout from 6.0.3 to 7.0.1 (#227)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.3 to 7.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](df4cb1c069...3d3c42e5aa)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-18 09:29:14 -06:00
dependabot[bot]
6492f7d5bc
build(deps): bump actions/setup-go from 6.4.0 to 7.0.0 (#228)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 6.4.0 to 7.0.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](4a3601121d...b7ad1dad31)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-18 09:29:06 -06:00
Matthew Slipper
58a61a47e9
fix(mcp): handle POST requests consistently (#254) 2026-09-18 09:27:31 -06:00
Burak Karakan
2393dd175a
feat(secrets): add Vault KV source (#238)
* feat(secrets): add Vault KV source

* chore: narrow Vault KV change

* fix(secrets): preserve Vault KV warnings

* fix(secrets): lowercase Vault error

---------

Co-authored-by: Matthew Slipper <me@matthewslipper.com>
2026-09-02 12:42:46 -07:00
Brendan Ryan
7f947f2f84
fix: include upstream scheme in retry decisions (#221) 2026-08-14 23:30:47 -06:00
Matthew Slipper
564f7bac97
fix: allow configured retry handlers in denied private CIDRs (#219)
* fix: permit configured internal retry handlers

* fix: centralize metadata address protections

---------

Co-authored-by: Brendan Ryan <1572504+brendanjryan@users.noreply.github.com>
2026-08-05 09:17:43 -06:00
Matthew Slipper
c751a69c77
feat: add authenticated response retry handling (#217)
* feat: add bounded response retry handler

* feat: add authenticated MPP charge replay

* fix: propagate MPP replay trace context

* fix: harden response retry handling

* fix: bypass response retries for streams

* test: expand response retry eligibility coverage

* fix: guard response retry handler connections

---------

Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com>
Co-authored-by: Brendan Ryan <1572504+brendanjryan@users.noreply.github.com>
2026-08-03 12:13:31 -06:00
Connor Justice
c90f4fe316
feat(proxy): support HTTP/2 (gRPC) upstreams in MITM mode (#212)
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>
2026-07-24 13:43:23 -06:00
Matthew Slipper
c8724937fb
fix: preserve buffered body for GCP token inspection (#210) 2026-07-18 18:44:31 -06:00
Matthew Slipper
74f7bf494e
fix: keep tunnel connections alive during hijacked WebSocket relays (#209)
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.
2026-07-08 13:55:54 -06:00
60 changed files with 6695 additions and 398 deletions