← Back to Pull requests

Support client hellos fragmented across multiple TLS records #8

Open
unknown opened this pull request with 242 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 16, 2026 07:11 UTC
Author

Fixes #7.

extractTlsHello only read the first 0x16 record, so a ClientHello that was fragmented across several handshake records (allowed by RFC 8446 section 5.1) failed with Unexpected client hello length, and trackClientHellos left tlsClientHello undefined even though Node's TLS server completes the handshake normally.

Changes:

  • extractTlsHello now keeps reading consecutive handshake records until the full handshake message (4-byte header + the 3-byte length it declares) has arrived. It returns both the raw bytes (still unshifted back into the stream unchanged, so the real TLS session is unaffected) and the reassembled handshake data that readTlsClientHello parses.

  • Single-record hellos follow the same path as before, and the existing length check still rejects trailing data in the hello.

  • The declared hello length is capped at 131396 bytes, which is OpenSSL's CLIENT_HELLO_MAX_LENGTH. Without a cap, a client could make the parser buffer up to 16MB before Node's TLS stack sees anything. Happy to drop or change this if you'd prefer a different limit.

  • A non-handshake record arriving partway through a fragmented hello is rejected.
  • Tests:

  • Parses the Chrome fixture after re-framing it into 3 records, with the first split inside the 4-byte handshake header. It checks that the result (and JA3/JA4) matches the single-record parse, and that all consumed bytes are returned to the stream unchanged.

  • An end-to-end test captures a real Node ClientHello, sends it split across 2 records to a trackClientHellos TLS server, and checks that the handshake completes with tlsClientHello populated.
  • Both new tests fail on main and pass with this change. npm test: 38 passing, 1 pending on Node 22.23.5 and 24.22.1. On a Node 20 build linked against system OpenSSL 3.5.7, the same 4 fingerprint-value tests fail with and without this change, because they expect the bundled-OpenSSL fingerprints.

    Diff: 242 lines (+181 / -61) across 3 files Reviewer: pimterry Review duration: 20978m
    All Vouch review confidence checks passed
    Residual risk 0.33 = Change Risk (0.62) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.62 · 242 lines diff across 3 files
    0.62
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.329
    Sensitive Paths sensitive_paths
    0.062
    Real PR Conversation Timeline
    1 comments
    "Review active on #8"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 62.0% (MEDIUM) · Higher = larger blast radius
    62.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 33% · Safe to merge
    33%