Repository navigation
fix(javascript): omit TLS sockets whose secureProtocol Node rejects - #10530
Plastic-time wants to merge 5 commits into
Conversation
tls.connect builds its secure context before it opens a socket. A string secureProtocol outside Node's method names throws ERR_TLS_INVALID_PROTOCOL_METHOD, and a truthy secureProtocol beside a minVersion or maxVersion throws ERR_TLS_PROTOCOL_VERSION_CONFLICT. Apply the same secureContext bypass as the version members.
[Medium impact] The reviewed changes appear safe to merge. SummaryThe PR stops reporting socket acquisitions for
Reviews (4) · Last reviewed commit: "fix(javascript): treat class and regular..." · Reviewed by Greptile |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…ts text A no-substitution template is read exactly, so a template method name beside a version member now reaches the conflict check.
…protocol-refusals # Conflicts: # src/domain/javascript/javascriptSemanticResources.ts
Both evaluate to a fresh object, so the shared truthiness reader can decide
them like object, array and function literals. A secureProtocol written as
/x/ or class {} beside a version member now reaches the conflict check.
Summary
JavaScript static analysis reported a socket acquisition for
tls.connectcalls that Node rejects because ofsecureProtocol. These calls no longer produce aresourceOperationsacquisition, the same as a rejectedminVersion.Fixes #10524
Problem and expected behavior
Measured in Node 24.22.1 with
tls.connect({ port: 9, host: "127.0.0.1", ... }):secureProtocol"TLS_method","TLSv1_method","TLSv1_1_method","TLSv1_2_method","SSLv23_method", and their_client/_serverformssecureProtocol"bogus","","SSLv3_method","SSLv2_method","TLSv1_3_method","DTLS_method","tls_method","TLS_METHOD"secureProtocol5,true,{},nullalonesecureProtocolbeside aminVersionormaxVersionthat is not null or undefined"TLS_method"besideminVersion: nullormaxVersion: undefined;0beside aminVersionsecureContextnet.connect({ secureProtocol: "bogus" })Change and scope
rejectsTlsProtocolVersionLiteralnow ends withrejectsSecureProtocolLiteral, which readssecureProtocolthrough the sameeffectivereader. That reader already handles merged option objects, accessors,__proto__and the truthy-secureContextbypass.TLS_PROTOCOL_VERSIONS.secureProtocoland a version member proven to be neither null nor undefined. Unknown values stay.Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.
Contract and boundary impact
Semantic owner and earliest changed stage:
rejectsTlsProtocolVersionLiteralinjavascriptSemanticResources.ts.Contribution scope fit and linked maintainer decision: not applicable.
CLI and MCP/tool-catalog contract: none.
Provider, bridge, target-format, or platform compatibility: none.
Evidence, artifact, provenance, or reconstruction contract: fewer false socket facts; undecided calls are unchanged.
Target selection, authority, upstream behavior, and cleanup details: not applicable.
Generated metadata, package, or installation impact: none.
Read existing files or captured data.
Evidence and regression coverage
src/domain/javascript/javascriptSemanticAnalysis.tls_secure_protocol_literal.test.ts, one row per rejected and accepted form above.tls_protocol_version_literaltests still pass (128 passed for both files).Validation performed
Windows 11 Home 10.0.26200 x64, Node 24.22.1, base 9e24b36.
npx vitest run src/domain/javascript/javascriptSemanticAnalysis.tls_secure_protocol_literal.test.tson main source: 13 failed / 14 passed; with this change: 27 passed.npx vitest run src/domain/javascript src/application/javascript: 217 files, 6409 passed / 7 skipped.secureProtocol: `TLS_method`beside a version member reaches the conflict check.socketOptionReader; the only conflict was a doc comment, andrejectsSecureProtocolLiteralreads through the same reader. After the merge: the new file on main source 13 failed / 14 passed, with this change 27 passed;src/domain/javascript src/application/javascript218 files, 6502 passed / 7 skipped.staticJavaScriptTruthinessreader now decides a regular-expression literal and a class expression as truthy, sosecureProtocol: /x/orclass {}beside a version member reaches the conflict check. The new file now has 29 rows, all passing;src/domainandsrc/applicationshow no new failures.npm run check:fast: passed (typecheck, lint)git merge-treeagainst the open PRs that editjavascriptSemanticResources.ts: clean with every one that merges cleanly with main (fix(javascript): judge an options-object socket port like a positional one #9693, fix(javascript): resolve FileHandle releases after reassignment #10258, fix(js): degrade release resolution when the released method is replaced on the receiver #10473).Compatibility, safety, and release
Author readiness
Human owner: @Plastic-time
Before merge
type(scope): outcome.