feat(proxy): proxy, SOCKS5, mTLS, and TLS hardening support (closes #80) - #85
Open
Aidan Holland (thehappydinoa) wants to merge 5 commits into
Open
Aidan Holland (thehappydinoa) wants to merge 5 commits into
Aidan Holland (thehappydinoa) wants to merge 5 commits into
Conversation
Adds two optional fields under `proxy:` in config.yaml: - `url`: overrides HTTPS_PROXY/HTTP_PROXY env vars for all outbound requests - `ca-bundle`: path to a PEM file appended to the system CA pool for TLS verification Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…g options Adds full config.yaml support for locked-down corporate environments: proxy: url: supports http, https, socks5, and socks5h schemes tls: ca-bundle: PEM file appended to system CA pool insecure-skip-verify: disable TLS verification (escape hatch) client-cert / client-key: mTLS client certificate pair disable-http2: force HTTP/1.1 for incompatible proxies/networks http.New() now takes an Options struct instead of positional parameters. NO_PROXY/HTTP_PROXY/HTTPS_PROXY env vars continue to work unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ing, and path expansion - Move disable-http2 from tls: to proxy: (it's a transport setting, not TLS) - Add proxy: and tls: to defaultConfig so they're written to config.yaml on first run - Print a stderr warning whenever insecure-skip-verify is active - Warn (not crash) if the system CA pool can't be loaded, explaining only ca-bundle CAs will be trusted - Expand ~ and $ENV_VAR in ca-bundle, client-cert, and client-key paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Follows the same per-type file pattern as search.go, timeouts.go, etc. Each file owns its type definition and defaultXxxConfig variable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ack, and custom CA bundle - TestNew_ProxyURL_RoutesViaProxy: verifies proxy.url routes all requests through the configured proxy - TestNew_EnvProxy_UsedWhenNoProxyURL: verifies HTTP_PROXY env var is honoured when proxy.url is unset - TestNew_CABundle_AcceptsCustomCA: verifies tls.ca-bundle allows TLS connections to servers signed by a custom CA, and that a bare client correctly rejects the same server Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements issue #80 — proxy support within CLI config — extended to cover the full range of corporate/locked-down environment requirements.
All settings live under two new sections in
config.yaml:HTTP_PROXY,HTTPS_PROXY, andNO_PROXYenv vars continue to work unchanged and take effect whenproxy.urlis not set.Changes
internal/config/proxy.go(new) —ProxyConfigstruct +defaultProxyConfig, following the per-type file patterninternal/config/tls.go(new) —TLSConfigstruct +defaultTLSConfig, following the per-type file patterninternal/config/config.go—ProxyandTLSfields added toConfig; both referenced indefaultConfiginternal/pkg/clients/http/http.go—New()takes anOptionsstruct; proxy routing by scheme (HTTP vs SOCKS5);buildTLSConfighandles CA bundle, client cert, skip-verify;expandPathexpands~and$ENV_VARin file paths; stderr warning wheninsecure-skip-verifyis active; warns if system CA pool fails to loadinternal/pkg/clients/censys/censys.go— call site updated to pass all new options from configinternal/pkg/clients/http/http_test.go— updated for new API; full integration test coverage for all three manual test scenariosTest plan
go test ./...passes (all green)tls.insecure-skip-verify: trueprints stderr warning (fmt.FprintlninNew())TestNew_MissingCABundle,TestNew_MismatchedClientCert)TestNew_InvalidProxyURL,TestNew_UnsupportedProxyScheme)proxy.urlroutes all requests through the configured proxy (TestNew_ProxyURL_RoutesViaProxy— spins up a local proxy server and asserts it receives the request)tls.ca-bundleaccepts connections to servers signed by a custom CA (TestNew_CABundle_AcceptsCustomCA— generates an in-memory CA, signs a server cert, asserts the configured client succeeds and a bare client correctly fails)HTTP_PROXYenv var is honoured whenproxy.urlis unset (TestNew_EnvProxy_UsedWhenNoProxyURL— spins up a local proxy, sets env var, asserts the proxy receives the request)🤖 Generated with Claude Code