Skip to content

fix: harden HTTPS CA trust, IPv6 verification, and content-encoding parsing - #3504

Merged
ardatan merged 22 commits into
masterfrom
fix/bun-https-cleanup-timeout
Aug 12, 2026
Merged

fix: harden HTTPS CA trust, IPv6 verification, and content-encoding parsing#3504
ardatan merged 22 commits into
masterfrom
fix/bun-https-cleanup-timeout

Conversation

@ardatan

@ardatan ardatan commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

This PR improves HTTPS behavior across @whatwg-node/node-fetch and @whatwg-node/server, and stabilizes the HTTPS-related test matrix.

Runtime — @whatwg-node/node-fetch

  1. Libcurl CA store alignment

    • When tls.getCACertificates is available (Node.js 22.15+ / 23.10+), fetchCurl loads CAs from tls.getCACertificates('default') via CAINFO_BLOB.
    • Honors tls.setDefaultCACertificates(...) and NODE_EXTRA_CA_CERTS set before process start (same as Node’s built-in https client).
    • Older Node (engines still >=18) keeps the previous fallback: NODE_EXTRA_CA_CERTSCAINFO, else tls.rootCertificates.
  2. IPv6 HTTPS identity workaround (node-http ponyfill)

    • Works around nodejs/node#64032: some Node 22.23+ / 24.17+ builds fail to match IPv6 literals against IP Address SANs in tls.checkServerIdentity.
    • Custom verifier is installed lazily on the first HTTPS request, and only if a one-time probe shows the running Node build is affected.
    • Healthy Node builds keep the built-in verifier.
    • Native fetch / undici are unchanged.

Runtime — @whatwg-node/server

  1. Content-encoding header parsing
    • useContentEncoding and decompression helpers trim comma-separated Accept-Encoding / Content-Encoding tokens.
    • Fixes skipped compression when clients send values like br, gzip, deflate (common for undici over HTTPS): without trim, encodings after the first comma never matched.

Tests

  1. Shared node:https TestServer

    • In the shared server matrix when tls.setDefaultCACertificates exists (Node / Bun when exposed); not on Deno.
    • Ephemeral OpenSSL CA + leaf (test-tls-certs.ts), trusted via setDefaultCACertificates.
    • SAN covers localhost, 127.0.0.1, and ::1.
  2. Cleanup / external HTTPS

    • Internal matrix covers HTTP servers and node:https (body not consumed).
    • External https://httpbin.org remains best-effort (timeout + soft-skip for connectivity errors).
  3. Other suite hardening

    • http2.spec.ts uses the shared openssl helper + setDefaultCACertificates.
    • FormData / node.spec raw clients respect http vs https from the server URL.
    • IPv6 URL construction keeps the server scheme; native + node:https ipv6 stays skipped where undici still hits the Node bug.

Changesets

Changeset Package Notes
libcurl-default-ca-store @whatwg-node/node-fetch CA store alignment
ipv6-check-server-identity @whatwg-node/node-fetch Lazy IPv6 SAN workaround
trim-content-encoding-tokens @whatwg-node/server Trim encoding header tokens

Test plan

  • unit / bun, unit / deno, unit / node 18–26 green
  • type check / lint / prettier green
  • Cleanup: internal HTTP + node:https; external HTTPS soft-skips when unreachable
  • Compression: Native + node:https without explicit accept-encoding still compresses
  • checkServerIdentity.spec.ts passes
  • Review threads addressed

Copilot AI lite review requested due to automatic review settings August 12, 2026 15:46
@ardatan
ardatan force-pushed the fix/bun-https-cleanup-timeout branch from 879661c to 89c70d9 Compare August 12, 2026 15:47
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b232893-3582-4183-bebc-e54bd4ce282d

📥 Commits

Reviewing files that changed from the base of the PR and between 31aa3a0 and d9b2cc4.

📒 Files selected for processing (1)
  • packages/server/test/node.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/server/test/node.spec.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved HTTPS certificate trust handling by aligning libcurl connections with Node’s default CA store.
    • Preserved compatibility with older Node versions and existing extra certificate configuration.
  • Tests

    • Expanded HTTPS and HTTP/2 coverage with temporary TLS certificates.
    • Added HTTPS coverage for server and FormData request scenarios.
    • Improved cleanup for tests that exceed their timeout.
    • Added graceful handling for environments where required TLS features are unavailable.

Walkthrough

The change makes libcurl use Node’s default CA store when available. It adds ephemeral certificate generation and shared HTTPS test-server support. Related tests now use protocol-aware requests and bounded HTTPS cleanup.

Changes

CA and HTTPS infrastructure

Layer / File(s) Summary
libcurl default CA selection
packages/node-fetch/src/fetchCurl.ts, .changeset/libcurl-default-ca-store.md
libcurl prefers tls.getCACertificates('default') and retains existing fallbacks for older Node versions.
Ephemeral certificates and HTTPS server
packages/server/test/test-tls-certs.ts, packages/server/test/test-server.ts
Tests generate temporary CA and localhost certificates. The shared test server conditionally starts HTTPS servers and restores default CA certificates during disposal.
HTTPS-aware test execution
packages/node-fetch/tests/http2.spec.ts, packages/node-fetch/tests/cleanup-resources.spec.ts, packages/server/test/formdata.spec.ts, packages/server/test/node.spec.ts
Tests use default CA registration, protocol-aware request helpers, corrected IPv6 URL construction, and a three-second HTTPS cleanup timeout.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TestServer
  participant CertificateHelper
  participant NodeTLS
  participant HTTPSClient
  TestServer->>CertificateHelper: Generate ephemeral TLS certificates
  CertificateHelper-->>TestServer: Return CA and server credentials
  TestServer->>NodeTLS: Register the temporary CA
  TestServer->>HTTPSClient: Serve and receive HTTPS requests
  HTTPSClient-->>TestServer: Return test responses
  TestServer->>NodeTLS: Restore default CA certificates
Loading

Possibly related PRs

Suggested reviewers: enisdenjo

Poem

I’m a rabbit with certificates bright,
I hop through HTTPS tunnels tonight.
CA roots settle in Node’s store,
Tests clean up what they made before.
libcurl follows the trusted trail—
Thump, thump, the secure build prevails!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes HTTPS CA trust hardening and other related HTTPS fixes in the pull request.
Description check ✅ Passed The description directly explains the HTTPS runtime changes, test updates, CA trust behavior, and related fixes.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bun-https-cleanup-timeout

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ardatan
ardatan force-pushed the fix/bun-https-cleanup-timeout branch from 89c70d9 to 62a2d38 Compare August 12, 2026 15:47
Avoid flaky timeouts against httpbin.org in CI (especially unit/bun) while still exercising HTTPS fetch without consuming the body.
@ardatan
ardatan force-pushed the fix/bun-https-cleanup-timeout branch from 62a2d38 to ec52ce8 Compare August 12, 2026 15:47
Comment thread packages/node-fetch/tests/cleanup-resources.spec.ts Fixed
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@benchmarks/node-fetch results (noConsumeBody)

   ✓ active_handles.................: avg=135.327948 min=70       med=133     max=202      p(90)=162     p(95)=169    
     data_received..................: 45 MB  1.5 MB/s
     data_sent......................: 29 MB  974 kB/s
     http_req_blocked...............: avg=2.53µs     min=349ns    med=962ns   max=20.66ms  p(90)=1.89µs  p(95)=2.27µs 
     http_req_connecting............: avg=809ns      min=0s       med=0s      max=5.09ms   p(90)=0s      p(95)=0s     
     http_req_duration..............: avg=10.11ms    min=170.07µs med=9.53ms  max=464.63ms p(90)=14.73ms p(95)=17.04ms
       { expected_response:true }...: avg=10.11ms    min=170.07µs med=9.53ms  max=464.63ms p(90)=14.73ms p(95)=17.04ms
     http_req_failed................: 0.00%  ✓ 0           ✗ 295087
     http_req_receiving.............: avg=30.28µs    min=6.04µs   med=13.48µs max=22.77ms  p(90)=31.92µs p(95)=47.19µs
     http_req_sending...............: avg=10.95µs    min=1.96µs   med=4.55µs  max=20.59ms  p(90)=9.07µs  p(95)=13.4µs 
     http_req_tls_handshaking.......: avg=0s         min=0s       med=0s      max=0s       p(90)=0s      p(95)=0s     
     http_req_waiting...............: avg=10.07ms    min=103.19µs med=9.49ms  max=464.57ms p(90)=14.67ms p(95)=16.96ms
     http_reqs......................: 295087 9835.213115/s
     iteration_duration.............: avg=20.31ms    min=1.42ms   med=19.02ms max=476.22ms p(90)=25.44ms p(95)=28.6ms 
     iterations.....................: 147508 4916.423347/s
     vus............................: 100    min=100       max=100 
     vus_max........................: 100    min=100       max=100 

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@benchmarks/node-fetch results (consumeBody)

   ✓ active_handles.................: avg=139.915817 min=22      med=139     max=185     p(90)=161     p(95)=167    
     data_received..................: 22 MB  720 kB/s
     data_sent......................: 14 MB  462 kB/s
     http_req_blocked...............: avg=3.61µs     min=651ns   med=1.64µs  max=7.56ms  p(90)=2.17µs  p(95)=2.66µs 
     http_req_connecting............: avg=1.51µs     min=0s      med=0s      max=4.82ms  p(90)=0s      p(95)=0s     
     http_req_duration..............: avg=21.16ms    min=4.45ms  med=20.35ms max=1.02s   p(90)=27.06ms p(95)=31.25ms
       { expected_response:true }...: avg=21.16ms    min=4.45ms  med=20.35ms max=1.02s   p(90)=27.06ms p(95)=31.25ms
     http_req_failed................: 0.00%  ✓ 0           ✗ 141279
     http_req_receiving.............: avg=38.15µs    min=10.62µs med=25.71µs max=30.12ms p(90)=45.67µs p(95)=57.78µs
     http_req_sending...............: avg=12.97µs    min=3.7µs   med=8.04µs  max=14.38ms p(90)=12.86µs p(95)=19.85µs
     http_req_tls_handshaking.......: avg=0s         min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_waiting...............: avg=21.11ms    min=4.41ms  med=20.3ms  max=1.02s   p(90)=27ms    p(95)=31.16ms
     http_reqs......................: 141279 4708.880196/s
     iteration_duration.............: avg=42.43ms    min=15.3ms  med=40.36ms max=1.05s   p(90)=50.03ms p(95)=53.92ms
     iterations.....................: 70620  2353.790156/s
     vus............................: 100    min=100       max=100 
     vus_max........................: 100    min=100       max=100 

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@benchmarks/server results (undici)

     ✓ response code was 200
     ✓ valid response structure

   ✓ checks.........................: 100.00% ✓ 603526      ✗ 0     
     data_received..................: 60 MB   667 kB/s
     data_sent......................: 45 MB   500 kB/s
     http_req_blocked...............: avg=1.29µs   min=861ns    med=1.1µs    max=2.46ms   p(90)=1.35µs   p(95)=1.68µs  
     http_req_connecting............: avg=0ns      min=0s       med=0s       max=164.94µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=239.12µs min=187.63µs med=228.91µs max=13.75ms  p(90)=259.28µs p(95)=272.88µs
       { expected_response:true }...: avg=239.12µs min=187.63µs med=228.91µs max=13.75ms  p(90)=259.28µs p(95)=272.88µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 301763
     http_req_receiving.............: avg=26.99µs  min=14.1µs   med=26.65µs  max=5.45ms   p(90)=31.06µs  p(95)=32.97µs 
     http_req_sending...............: avg=7.28µs   min=5.25µs   med=6.35µs   max=5.3ms    p(90)=7.56µs   p(95)=9.76µs  
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=204.85µs min=154.41µs med=195.04µs max=13.67ms  p(90)=222.98µs p(95)=235.13µs
     http_reqs......................: 301763  3352.915536/s
     iteration_duration.............: avg=292.77µs min=234.6µs  med=281.67µs max=13.86ms  p(90)=318.26µs p(95)=335.16µs
     iterations.....................: 301763  3352.915536/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@benchmarks/server results (ponyfill)

     ✓ response code was 200
     ✓ valid response structure

   ✓ checks.........................: 100.00% ✓ 775306      ✗ 0     
     data_received..................: 76 MB   849 kB/s
     data_sent......................: 58 MB   642 kB/s
     http_req_blocked...............: avg=1.35µs   min=881ns    med=1.13µs   max=317.12µs p(90)=1.63µs   p(95)=1.87µs  
     http_req_connecting............: avg=0ns      min=0s       med=0s       max=151.07µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=170.13µs min=127.17µs med=166.1µs  max=5.69ms   p(90)=191.12µs p(95)=199.59µs
       { expected_response:true }...: avg=170.13µs min=127.17µs med=166.1µs  max=5.69ms   p(90)=191.12µs p(95)=199.59µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 387653
     http_req_receiving.............: avg=24.6µs   min=12.49µs  med=24.9µs   max=4.87ms   p(90)=30.58µs  p(95)=33.89µs 
     http_req_sending...............: avg=7.8µs    min=4.96µs   med=6.5µs    max=5.28ms   p(90)=9.3µs    p(95)=13.03µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=137.72µs min=94.71µs  med=133.16µs max=5.14ms   p(90)=154.64µs p(95)=162.22µs
     http_reqs......................: 387653  4307.238052/s
     iteration_duration.............: avg=226.26µs min=168.78µs med=221.13µs max=8.06ms   p(90)=250.27µs p(95)=262.8µs 
     iterations.....................: 387653  4307.238052/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stabilizes the node-fetch “cleanup resources” HTTPS test in CI (notably Bun) by removing reliance on an external https://httpbin.org/get request and instead exercising HTTPS fetch against a local self-signed HTTPS server.

Changes:

  • Replaces the external HTTPS request with a local ephemeral HTTPS server using a self-signed certificate.
  • Adds Jest beforeAll/afterAll lifecycle management to create/close the HTTPS server and temporarily relax TLS verification for the suite.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/node-fetch/tests/cleanup-resources.spec.ts Outdated
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@benchmarks/server results (native)

     ✓ response code was 200
     ✓ valid response structure

   ✓ checks.........................: 100.00% ✓ 565470      ✗ 0     
     data_received..................: 56 MB   625 kB/s
     data_sent......................: 42 MB   468 kB/s
     http_req_blocked...............: avg=1.59µs   min=751ns    med=1.36µs   max=1.42ms   p(90)=1.95µs   p(95)=2.45µs  
     http_req_connecting............: avg=0ns      min=0s       med=0s       max=146.97µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=247.86µs min=175.45µs med=241.31µs max=9.68ms   p(90)=275.51µs p(95)=286.25µs
       { expected_response:true }...: avg=247.86µs min=175.45µs med=241.31µs max=9.68ms   p(90)=275.51µs p(95)=286.25µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 282735
     http_req_receiving.............: avg=31.21µs  min=12.83µs  med=30.88µs  max=2.87ms   p(90)=39.19µs  p(95)=41.25µs 
     http_req_sending...............: avg=9.2µs    min=4.48µs   med=8.56µs   max=5.36ms   p(90)=12.22µs  p(95)=13.45µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=207.44µs min=148.86µs med=200.65µs max=9.61ms   p(90)=231.55µs p(95)=241.65µs
     http_reqs......................: 282735  3141.488073/s
     iteration_duration.............: avg=311.46µs min=217.81µs med=304.47µs max=9.79ms   p(90)=342.83µs p(95)=355.94µs
     iterations.....................: 282735  3141.488073/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@benchmarks/server results (vanilla)

     ✓ response code was 200
     ✓ valid response structure

   ✓ checks.........................: 100.00% ✓ 814320      ✗ 0     
     data_received..................: 74 MB   823 kB/s
     data_sent......................: 61 MB   674 kB/s
     http_req_blocked...............: avg=1.31µs   min=842ns    med=1.11µs   max=300.39µs p(90)=1.57µs   p(95)=1.82µs  
     http_req_connecting............: avg=0ns      min=0s       med=0s       max=150.07µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=159.14µs min=114.82µs med=155.71µs max=5.34ms   p(90)=180.53µs p(95)=188.51µs
       { expected_response:true }...: avg=159.14µs min=114.82µs med=155.71µs max=5.34ms   p(90)=180.53µs p(95)=188.51µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 407160
     http_req_receiving.............: avg=24.19µs  min=12.62µs  med=24.65µs  max=3.27ms   p(90)=31.03µs  p(95)=34.5µs  
     http_req_sending...............: avg=7.59µs   min=4.95µs   med=6.46µs   max=4.72ms   p(90)=9µs      p(95)=12.35µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=127.35µs min=84.99µs  med=123.47µs max=5.29ms   p(90)=144.22µs p(95)=151.51µs
     http_reqs......................: 407160  4523.996362/s
     iteration_duration.............: avg=215.49µs min=158.8µs  med=212.88µs max=6.4ms    p(90)=241.52µs p(95)=251.94µs
     iterations.....................: 407160  4523.996362/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@benchmarks/server results (uws)

     ✓ response code was 200
     ✓ valid response structure

   ✓ checks.........................: 100.00% ✓ 773042      ✗ 0     
     data_received..................: 65 MB   717 kB/s
     data_sent......................: 58 MB   640 kB/s
     http_req_blocked...............: avg=1.3µs    min=871ns    med=1.15µs   max=296.75µs p(90)=1.58µs   p(95)=1.81µs  
     http_req_connecting............: avg=0ns      min=0s       med=0s       max=144.44µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=171.45µs min=121.26µs med=165.61µs max=8.66ms   p(90)=189.36µs p(95)=197.14µs
       { expected_response:true }...: avg=171.45µs min=121.26µs med=165.61µs max=8.66ms   p(90)=189.36µs p(95)=197.14µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 386521
     http_req_receiving.............: avg=23.39µs  min=12.25µs  med=23.87µs  max=2.56ms   p(90)=28.5µs   p(95)=30.36µs 
     http_req_sending...............: avg=7.49µs   min=4.96µs   med=6.41µs   max=5.1ms    p(90)=8.91µs   p(95)=11.73µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=140.56µs min=88.07µs  med=133.5µs  max=8.59ms   p(90)=155.91µs p(95)=162.33µs
     http_reqs......................: 386521  4294.672826/s
     iteration_duration.............: avg=227.11µs min=165.29µs med=221.41µs max=8.75ms   p(90)=248.76µs p(95)=258.95µs
     iterations.....................: 386521  4294.672826/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

Register a shared node:https test server trusted via NODE_EXTRA_CA_CERTS / setDefaultCACertificates, keep httpbin.org HTTPS as best-effort, and make fetchCurl honor extra CA certs through CAINFO_BLOB.
@ardatan ardatan changed the title fix(test): stabilize HTTPS cleanup resource test in CI fix(test): stabilize HTTPS cleanup tests without flaky httpbin dependency Aug 12, 2026
Comment thread packages/server/test/test-server.ts Fixed
Avoid NODE_TLS_REJECT_UNAUTHORIZED (CodeQL), skip node:https where pem/CA APIs are unavailable (Bun/Deno/older Node), and keep the server scheme when hitting [::1].
Trust ephemeral test certs only via NODE_EXTRA_CA_CERTS / setDefaultCACertificates in the test server helper.
Use Node's default CA store for libcurl instead of NODE_EXTRA_CA_CERTS, and align HTTPS test helpers on setDefaultCACertificates only.
Avoid dropping the previous libcurl CA path on older runtimes.
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@whatwg-node/node-fetch 0.8.7-alpha-20260812174353-1c03a6e0ec9ef41a744a20f75d8d94c90cb262fc npm ↗︎ unpkg ↗︎
@whatwg-node/server 0.11.1-alpha-20260812174353-1c03a6e0ec9ef41a744a20f75d8d94c90cb262fc npm ↗︎ unpkg ↗︎

…ient

Replace pem with an openssl CA+leaf helper and bridge Deno native fetch trust through Deno.createHttpClient, since it ignores tls.setDefaultCACertificates.
Keep node:https in the shared Node test matrix, drop the unused Deno CA bridge, and use https.request when suites hit https:// servers.
Parameters<typeof httpRequest> collapsed overloads and broke typecheck.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/libcurl-default-ca-store.md:
- Line 11: Update the guidance around tls.setDefaultCACertificates() to state
that the example requires Node.js 22.19.0 or 24.5.0 and later, or guard the
setter usage so unsupported Node.js versions do not execute it.

In `@packages/node-fetch/tests/cleanup-resources.spec.ts`:
- Around line 38-46: Update the catch handling in cleanup-resources.spec.ts to
soft-skip supported backend connectivity failures from node-libcurl, undici,
built-in undici, and node:http, normalizing their error shapes alongside the
existing AbortError and TimeoutError cases. Preserve rethrowing unexpected
application errors.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 26a87349-f2f5-47de-b29a-8f9553b76413

📥 Commits

Reviewing files that changed from the base of the PR and between c50081b and 31aa3a0.

📒 Files selected for processing (8)
  • .changeset/libcurl-default-ca-store.md
  • packages/node-fetch/src/fetchCurl.ts
  • packages/node-fetch/tests/cleanup-resources.spec.ts
  • packages/node-fetch/tests/http2.spec.ts
  • packages/server/test/formdata.spec.ts
  • packages/server/test/node.spec.ts
  • packages/server/test/test-server.ts
  • packages/server/test/test-tls-certs.ts

Comment thread .changeset/libcurl-default-ca-store.md Outdated
Comment thread packages/node-fetch/tests/cleanup-resources.spec.ts
…A docs

Address CodeRabbit: document setDefaultCACertificates Node version floor, and treat DNS/connection failures like timeouts in the httpbin cleanup test.
Node 22.23+/24.17+ break IPv6 IP-SAN matching in checkServerIdentity
(nodejs/node#64032). Keep the test on HTTP servers.
Work around Node tls.checkServerIdentity IPv6 regression and cover it with unit + https matrix tests.
Cache a one-time tls.checkServerIdentity probe so healthy Node builds keep the built-in verifier.
@ardatan ardatan changed the title fix(test): stabilize HTTPS cleanup tests without flaky httpbin dependency fix(node-fetch): align HTTPS CA trust and harden IPv6 / cleanup tests Aug 12, 2026
@ardatan
ardatan requested review from enisdenjo and removed request for enisdenjo August 12, 2026 17:33
Undici HTTPS sends 'br, gzip, deflate'; without trim, later encodings never matched and compression was skipped.
External connectivity failures (socket hang up / other side closed) should not fail CI.
@ardatan ardatan changed the title fix(node-fetch): align HTTPS CA trust and harden IPv6 / cleanup tests fix: harden HTTPS CA trust, IPv6 verification, and content-encoding parsing Aug 12, 2026
@ardatan
ardatan merged commit b4c83ab into master Aug 12, 2026
28 checks passed
@ardatan
ardatan deleted the fix/bun-https-cleanup-timeout branch August 12, 2026 18:03
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.

3 participants