Conversation
Per-request rejectUnauthorized/ca/servername were silently ignored when the https.Agent set the same option, because http.Agent merges request options over the agent's own, letting the agent win. Capture the per-request overrides and re-apply them in createConnection(), mirroring the checkServerIdentity handling from CVE-2026-58040. Refs: nodejs@52a8ace880d Signed-off-by: axedos <acceleratingssoul@proton.me>
Collaborator
|
Review requested:
|
Contributor
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66288 +/- ##
==========================================
- Coverage 90.37% 90.35% -0.02%
==========================================
Files 790 790
Lines 273807 273850 +43
Branches 52367 52389 +22
==========================================
- Hits 247446 247441 -5
- Misses 16869 16918 +49
+ Partials 9492 9491 -1
🚀 New features to boost your workflow:
|
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.
Per-request TLS options passed to
https.request() / https.get()are silentlyignored when the
https.Agentin use was constructed with the same option.http.Agentmerges the request options over the agent's own options, lettingthe agent's value win.
That is surprising and can weaken security for TLS options in particular: a
per-request
rejectUnauthorized: trueon an agent configured withrejectUnauthorized: falsestill sends the request with certificateverification disabled. The same applies to ca and servername.
CVE-2026-58040 already handled this for
checkServerIdentityby tagging therequest so the socket is not reused. This change generalizes that approach:
when a per-request rejectUnauthorized, ca, or servername differs from the
agent's value, request() captures the override and createConnection()
re-applies it, and the socket is not reused.
Refs: 52a8ace880d