Fleet registration in pkg/agentic already goes through the shared
&http.Client{Timeout: 30s} at transport.go:13 — no InsecureSkipVerify,
no custom TLS transport. This audit documents that finding and adds
regression coverage so future refactors can't silently strip TLS
validation from the /v1/fleet/register path.
Verdict: OK. No production bug. Tests pass trusted TLS server case
and reject untrusted cert with a wrapped error that surfaces the
certificate / x509 / tls signal in the message.
Closes tasks.lthn.sh/view.php?id=29
Co-authored-by: Codex <noreply@openai.com>
Co-Authored-By: Virgil <virgil@lethean.io>
2.3 KiB
2.3 KiB
Fleet HTTPS Certificate Audit - 2026-04-23
Verdict
OK
Fleet registration already goes through a TLS-validating http.Client; no production code in pkg/agentic overrides TLS verification on the /v1/fleet/register path. The audit added regression coverage so this path now fails loudly if certificate verification is bypassed or broken.
What was checked
- Fleet registration is implemented by
handleFleetRegister, which builds the registration payload and posts it to/v1/fleet/registerviaplatformPayloadatpkg/agentic/platform.go:199,pkg/agentic/platform.go:210, andpkg/agentic/platform.go:221. platformPayloadsends that request throughHTTPDowith a Bearer token and the platform base URL fromsyncAPIURL()atpkg/agentic/platform.go:558,pkg/agentic/platform.go:569, andpkg/agentic/sync.go:252.HTTPDodelegates tohttpDo, andhttpDoexecutes the request withdefaultClient.Do(request)atpkg/agentic/transport.go:99,pkg/agentic/transport.go:139, andpkg/agentic/transport.go:161.- The only shared production client on this path is
defaultClient, defined as&http.Client{Timeout: 30 * time.Second}with no custom transport or TLS override atpkg/agentic/transport.go:13.
Regression coverage added
testDefaultClientWithTrustedServerCertnow builds a client that trusts only the test server certificate viaRootCAs, and it explicitly assertsInsecureSkipVerifystaysfalseatpkg/agentic/platform_test.go:20andpkg/agentic/platform_test.go:28.TestPlatform_HandleFleetRegister_Good_TrustedTLSproves the real fleet registration path succeeds against a TLS endpoint when the certificate is trusted by the client atpkg/agentic/platform_test.go:104,pkg/agentic/platform_test.go:114, andpkg/agentic/platform_test.go:121.TestPlatform_HandleFleetRegister_Bad_UntrustedTLSCertproves the same registration path rejects an untrusted certificate, never reaches the handler, and returns a wrapped error instead of succeeding silently atpkg/agentic/platform_test.go:131,pkg/agentic/platform_test.go:144,pkg/agentic/platform_test.go:145, andpkg/agentic/platform_test.go:149.
Test run
go test -mod=mod ./pkg/agentic/...passed in a temp workspace that preserved the repo's../mcpreplace layout.