Skip to content

feat(proxy): proxy, SOCKS5, mTLS, and TLS hardening support (closes #80) - #85

Open
Aidan Holland (thehappydinoa) wants to merge 5 commits into
mainfrom
feat/proxy-support
Open

Aidan Holland (thehappydinoa) wants to merge 5 commits into
mainfrom
feat/proxy-support

Conversation

@thehappydinoa

@thehappydinoa Aidan Holland (thehappydinoa) commented Aug 28, 2026

Copy link
Copy Markdown
Member

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:

proxy:
  url: socks5://proxy.corp.internal:1080   # http, https, socks5, socks5h
  disable-http2: false                     # force HTTP/1.1 for broken proxies

tls:
  ca-bundle: /etc/ssl/corp-ca.pem          # appended to system CA pool; supports ~ and $ENV_VAR
  insecure-skip-verify: false              # disable TLS verification (prints a stderr warning when active)
  client-cert: /etc/ssl/client.pem         # mTLS client certificate; supports ~ and $ENV_VAR
  client-key:  /etc/ssl/client-key.pem     # mTLS private key; supports ~ and $ENV_VAR

HTTP_PROXY, HTTPS_PROXY, and NO_PROXY env vars continue to work unchanged and take effect when proxy.url is not set.

Changes

  • internal/config/proxy.go (new) — ProxyConfig struct + defaultProxyConfig, following the per-type file pattern
  • internal/config/tls.go (new) — TLSConfig struct + defaultTLSConfig, following the per-type file pattern
  • internal/config/config.goProxy and TLS fields added to Config; both referenced in defaultConfig
  • internal/pkg/clients/http/http.goNew() takes an Options struct; proxy routing by scheme (HTTP vs SOCKS5); buildTLSConfig handles CA bundle, client cert, skip-verify; expandPath expands ~ and $ENV_VAR in file paths; stderr warning when insecure-skip-verify is active; warns if system CA pool fails to load
  • internal/pkg/clients/censys/censys.go — call site updated to pass all new options from config
  • internal/pkg/clients/http/http_test.go — updated for new API; full integration test coverage for all three manual test scenarios

Test plan

  • go test ./... passes (all green)
  • tls.insecure-skip-verify: true prints stderr warning (fmt.Fprintln in New())
  • Missing/invalid CA bundle, mismatched client cert/key return clear errors (TestNew_MissingCABundle, TestNew_MismatchedClientCert)
  • Invalid proxy URL and unsupported scheme return clear errors (TestNew_InvalidProxyURL, TestNew_UnsupportedProxyScheme)
  • proxy.url routes all requests through the configured proxy (TestNew_ProxyURL_RoutesViaProxy — spins up a local proxy server and asserts it receives the request)
  • tls.ca-bundle accepts 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_PROXY env var is honoured when proxy.url is unset (TestNew_EnvProxy_UsedWhenNoProxyURL — spins up a local proxy, sets env var, asserts the proxy receives the request)

🤖 Generated with Claude Code

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>
@thehappydinoa
Aidan Holland (thehappydinoa) requested a review from a team as a code owner August 28, 2026 21:41
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant