fix(tls): preserve dynamic peer certificates - #9911
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe native net extension stops handling ChangesTLS peer certificate dispatch
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to TLS peer-certificate inspection now returns the complete negotiated certificate through the standard TLS path, including across secure-context rotation. The current change is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Landed on |
When a
TLSSocketflowed through a callback, dynamicgetPeerCertificate()dispatch was intercepted byperry-ext-net's reduced HTTPS facade. Directtls.connect()sockets never populate that facade's optional CN field, so both the original and rotated server certificates appeared as{}even though the negotiated DER bytes were recorded correctly.The extension now leaves
getPeerCertificate()to the primary stdlib handle dispatcher, which builds Node's legacy certificate object from the recorded DER. This preserves the first connection's certificate while a server rotates its secure context and exposes the new certificate to later connections.Refs #9202.
Validation:
tls/context/server-context-rotation.tsoutput matches Node 26.5.1perry-ext-net: 33 passedcargo check -p perry-stdlibpassed during path isolation./scripts/run_lint_gates.sh: all 64 gates passed, 2 CI-only skippedSummary by CodeRabbit
TLSSocket.getPeerCertificate()so it returns the complete negotiated certificate.