mitm: add server's own hostname as SAN on minted leaf certs#166
Merged
dangtony98 merged 3 commits intomainfrom May 11, 2026
Merged
mitm: add server's own hostname as SAN on minted leaf certs#166dangtony98 merged 3 commits intomainfrom
dangtony98 merged 3 commits intomainfrom
Conversation
Clients that route HTTPS_PROXY to the agent-vault MITM proxy and TLS-verify against the proxy's own hostname (rather than the upstream SNI) currently fail because minted leaves only carry the upstream's SAN. Reuse the existing AGENT_VAULT_ADDR / baseURL plumbing to add the proxy's hostname as an additional SAN on every leaf, so the proxy-hop handshake matches without a shim. Routes IP literals into IPAddresses and DNS names into DNSNames, deduping against the primary SNI.
|
💬 Discussion in Slack: #pr-review-agent-vault-166-mitm-add-server-s-own-hostname-as-san-on-minted-leaf-c Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel. |
The prior comment claimed "malformed entries are silently dropped," but the only filtering in New() is an empty-string check; non-IP entries are treated as DNS names without further validation.
Contributor
Author
|
@claude review |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Addresses review feedback on PR #166: - ExtraSANs entries now run through validateSNI so malformed inputs (underscores, leading hyphens, spaces, etc.) are silently dropped instead of being appended to DNSNames verbatim. Docstring updated to match. - Extra-DNS dedup against the per-request SNI uses strings.EqualFold, matching RFC 6125 case-insensitive DNS-ID semantics. Avoids redundant SANs when AGENT_VAULT_ADDR carries mixed case. - .env.example mentions the new MITM SAN-injection side effect of AGENT_VAULT_ADDR, in line with the docs/ updates and CLAUDE.md's env-var doc convention.
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
HTTPS_PROXYto the agent-vault MITM proxy and TLS-verify against the proxy's own hostname (rather than the upstream SNI) currently fail because minted leaves only carry the upstream's SAN. Today the workaround is aInsecureSkipVerifyshim on the client side.AGENT_VAULT_ADDR/baseURLplumbing (already threaded intomitm.Options.BaseURLfor help-link text) to add the proxy's hostname as an additional SAN on every minted leaf. Newca.Options.ExtraSANs []stringis populated once at boot inattachMITMIfEnabledfromsrv.BaseURL();MintLeafappends it to the cert template, routing IP literals intoIPAddressesand DNS names intoDNSNames, deduping against the primary SNI.AGENT_VAULT_ADDR=http://agent-vault-hnh0:14321on a service and every minted leaf now carriesagent-vault-hnh0as a SAN — the shim can be deleted.Implementation notes
*tls.Certificateinstances remain consistent).MintLeaf's signature is unchanged; the two MITM call sites (internal/mitm/proxy.go:120,internal/mitm/connect.go:110) are untouched.AGENT_VAULT_ADDRenv-var description updated in bothdocs/self-hosting/environment-variables.mdxanddocs/reference/cli.mdxto mention the new SAN behavior.Test plan
make test— full Go suite green; newTestMintLeaf_IncludesExtraDNSSansandTestMintLeaf_IncludesExtraIPSanscover the SAN injection + dedup paths and the IP-vs-DNS routing.go vet ./...clean.AGENT_VAULT_ADDR=http://agent-vault-hnh0:14321, redeploy, confirmopenssl s_client -connect agent-vault-hnh0:14322 -servername api.linear.app | openssl x509 -text -nooutshowsDNS:agent-vault-hnh0alongsideDNS:api.linear.app, then drop the talent-agentInsecureSkipVerifyshim and verify the client connects clean.