Skip to content

feat(anchors): add TLS certificate pinning to AnchorVerifier (#780) - #820

Open
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/anchor-cert-pinning-780
Open

feat(anchors): add TLS certificate pinning to AnchorVerifier (#780)#820
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/anchor-cert-pinning-780

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026

Copy link
Copy Markdown

Adds optional TLS certificate pinning to AnchorVerifier so compromised DNS or rogue CAs cannot silently redirect anchor requests to malicious servers.

Changes

  • New option on AnchorVerifierOptions: pinnedCertFingerprints mapping domain to expected SHA-256 fingerprint.
  • Verification flow: after resolving home_domain, if a pin exists, a raw TLS connection is opened to :443 and the peer certificate fingerprint is compared.
  • On mismatch the verification fails with issue code certificate_pinning_mismatch.
  • Browser safety: the tls module is dynamically imported; in browsers where it is absent, the check is skipped.
  • New error class: CertificatePinningError exposes domain, expectedFingerprint, and actualFingerprint.
  • Tests: test/anchorVerifierPinning.test.ts covers error shape, missing fingerprint, and options passthrough.

Closes #780

…-split#780)

- Add pinnedCertFingerprints option to AnchorVerifierOptions
- Add getCertFingerprint helper using Node.js tls module (dynamic import)
- Check certificate before TOML fetch when fingerprint is configured
- Add verifyCertificatePinning(domain) public method
- Add CertificatePinningError with domain, expected, and actual fingerprints
- Add unit tests for error shape and options passthrough

Closes Stellar-split#780
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add certificate pinning check for anchor HTTPS endpoints in AnchorVerifier

1 participant