Skip to content

Inspect HTTPS request and response bodies with a trusted CA - #22

Merged
biancarosa merged 2 commits into
mainfrom
feat/https-inspection
Sep 18, 2026
Merged

biancarosa merged 2 commits into
mainfrom
feat/https-inspection

Conversation

@biancarosa

@biancarosa biancarosa commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Netkit currently records CONNECT establishment but cannot show the encrypted requests inside a tunnel. Add opt-in serve --inspect-https --ca-cert ... --ca-key ... to inspect all proxied destinations when clients trust the supplied CA. The existing dashboard and history API display decrypted URLs, headers, and request/response bodies.

netkit ca generates a persistent CA without overwriting existing files, with a private key mode of 0600. Origin certificate verification stays enabled. The interception path preserves keep-alive, redirects, OPTIONS, cancellation, streaming responses/SSE, and Node fetch's plaintext CONNECT behavior. Shutdown closes inspected tunnels.

Validation: go test -race ./..., existing go test -tags=e2e ./test/e2e, golangci-lint run ./..., CLI build, and diff checks passed. Integration tests exercise HTTPS body capture, trust rejection on both sides, DNS/IP certificates, streaming, redirects, plaintext CONNECT, and shutdown. A real curl HTTPS POST through the built CLI returned 200; history contained the dummy JSON request and matching response body.

Inspection negotiates HTTP/1.1. WebSocket/protocol upgrades return 501; frame inspection is outside this change. Complete bodies are kept in memory, including credentials, and stream records appear at completion/disconnection. README includes CA setup and client trust instructions. This PR adds the inspection capability; deployments must configure their clients to trust the CA.

@biancarosa
biancarosa merged commit d1c0838 into main Sep 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant