Repository navigation
feat(express): add host-scoped CA trust and SPKI pinning for BitGo connections - #10033
Draft
zahin-mohammad wants to merge 2 commits into
Draft
zahin-mohammad wants to merge 2 commits into
zahin-mohammad wants to merge 2 commits into
Conversation
…nnections Add an opt-in outbound TLS policy applied only to BitGo hostnames. A CA bundle (BITGO_CA_BUNDLE_PATH) replaces the system trust store for those hosts, and optional SPKI pins (BITGO_SPKI_PINS) must match a certificate in the presented chain. All other destinations keep the system store. The policy is attached in BitGoAPI.getAgentRequest, the single builder for BitGo-bound requests. Requests to policy hosts do not follow redirects, and the policy cannot be combined with BITGO_USE_PROXY since a proxy agent would bypass it. TICKET: WCN-3731 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Other sdk-api suites call nock.disableNetConnect() globally, which blocked the local HTTPS servers when the full suite ran. TICKET: WCN-3731 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Contributor
|
|
This branch has not been deployed
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 WCN-3731. Adds an opt-in outbound TLS policy to BitGo Express that applies only to BitGo hostnames. Everything else (external signer, block explorers, KMS, etc.) keeps the system CA store.
BITGO_CA_BUNDLE_PATH/--bitgocabundlepath: PEM of the only CAs trusted for BitGo hosts (replaces, not extends, the system store for them).BITGO_SPKI_PINS/--bitgospkipins: base64 SHA-256 SPKI pins; one certificate in the presented chain must match. Pinning a CA/intermediate key survives leaf rotation; include a backup pin.BITGO_TLS_HOSTS/--bitgotlshosts: extra covered hostnames. The host of the configuredBITGO_ENV/BITGO_CUSTOM_ROOT_URIis always covered.tlsPolicyoption pluscreateBitGoTlsPolicy, enforced inBitGoAPI.getAgentRequest, the single builder for BitGo-bound requests (coversrequestPatch,/client/constantsand asset requests).Design decisions to review
redirects(0)). superagent keepsca/agenton the request across hops, so following a redirect could not re-evaluate the host policy. Cost: any 3xx from BitGo becomes an error when the policy is on.BITGO_USE_PROXY. A proxy agent owns the TLS socket and would silently bypass the policy, so Express refuses to start and the SDK constructor throws.Out of scope / follow-ups
BitGoAPI(external signer calls,sdk-api/src/v1/wallet.tsexplorer call, coin-module explorers) are intentionally unaffected; they are not BitGo hosts.BITGO_TLS_HOSTS.Testing
test/unit/tlsPolicy.ts(real local HTTPS servers, certs from two separate CAs generated withopenssl): approved CA accepted, unapproved CA rejected, SPKI pin match / CA-key pin / mismatch, non-BitGo host stays on default trust, redirect off-host not followed, proxy conflict, host matching (evilbitgo.com,bitgo.com.evil.example, http).test/unit/tlsPolicy.tsandconfig.tsprecedence for the new options.TICKET: WCN-3731
🤖 Generated with Claude Code