Repository navigation
fix(javascript): reject an http method token Node refuses at the call site - #9683
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 632392c78f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Both fixed in An erased TypeScript assertion hides the options object. A leading spread shifts the options slot. Confirmed:
The spread fills both runtime slots and the trailing object is ignored, so this branch was inspecting an argument Node never reads and dropping a real request. A spread argument now leaves the position unresolved and keeps the request — the same rule as the TLS overload-slot reader on You also suggested sharing the normalized selection with 18 cases; the two new ones fail against the pre-fix file and pass here. |
3db1fac to
76926ce
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76926ce8da
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Both fixed in A callable first argument is the callback.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e36db24d5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Both fixed in Only a callable in slot 0 is the callback. A getter only rewrites a member that follows it.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28e9b304e3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Both fixed in An erased assertion leaves the same callback.
Worth recording: my first attempt folded both groups into one number (
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afe3cae7ce
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
All three fixed in A redefined key keeps its first insertion position. Confirmed:
The helper now takes each key's position from its first insertion and its descriptor from the last. That is the distinction I had been collapsing: position and descriptor are two different facts about a redefined key, and using the AST index of the last write was reading the wrong one. Only an ECMAScript array index enumerates in the integer group. Confirmed the boundary:
The predicate is A spread after the options slot cannot move it.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a08abb2e4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
4a08abb to
67d62e1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67d62e118e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
All four fixed in
A spread supplies the first insertion position. A computed accessor can run before any named member.
On the duplicate tests: you were right, both standalone cases repeated entries in the
|
A review finding, measured on Node 24.22.1. `ClientRequest` copies the options with
`Object.assign`, so a getter enumerated before `path` runs first and can rewrite the value that
is then validated:
| call | outcome |
| --- | --- |
| `{get agent() { this.path = "/ok"; return undefined; }, path: "/a b"}` | request constructed |
| `{path: "/a b", get agent() { this.path = "/ok"; }}` | THREW `ERR_UNESCAPED_CHARACTERS` |
`optionGetterPrecedesMember` compares enumeration order rather than source order, because
`Object.assign` does not follow the source: an ECMAScript array index comes first and a redefined
key keeps its first insertion position while its descriptor comes from the last write.
Note for merge order: morluto#9683 carries the same ordering rule for `options.method` on this file. If
that lands first, `methodGetterPrecedesMember` and this helper are the same function and should be
collapsed into one.
`src/domain/javascript`: 5422 passing. Reverting the reader fails 2 of the new cases.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6c96470ed
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
All three fixed in A callable binding is the callback. Confirmed:
The HTTPS head is unwrapped once at the top of the function. Only the colon form
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ab666be89
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
6ab666b to
d7355cd
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7355cdf87
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
I replaced this branch with a much smaller slice ( Why it shrank. Every finding below was real, and the fixes for them grew the change to 468 lines of one function — eight commits, 25 review threads, and still growing. That growth was itself the problem: I was trying to decide What the branch decides now. Only shapes where the copied value is certainly the syntactic one: slot 0 is an options literal, or slot 0 is a string, a template, or a verified The gaps this leaves, stated plainly:
The first and last are right. The middle three are the deliberate cost: the request is kept where Node would throw. That direction is the safe one — the alternative deletes real requests, which is the failure I have had to fix most often across these threads. The duplicate-test finding is moot: the test file is rewritten for the smaller scope, and each outcome appears once. The enumeration-order work belongs in its own change, where it can be reviewed as one piece instead of accreting one row per review round. I would rather hand you a 136-line change with a named gap than a 468-line one with the same gap plus ten more open threads. |
… site
`http`/`https` validate `options.method` with `checkIsHttpToken` before the request exists, so a
literal outside the RFC 9110 token class throws `ERR_INVALID_HTTP_TOKEN` and no request is
created. The analyzer reported one anyway.
Measured on Node 24.22.1:
| call | outcome |
| --- | --- |
| `http.request({method: "BAD METHOD"})` | THREW `ERR_INVALID_HTTP_TOKEN` |
| `http.request({method: "GET"})`, `{method: "POST"}` | request constructed |
| `http.request({method: ""})` | request constructed — empty is a valid token, Node falls back to GET |
| `http.request("http://h/", {method: "BAD METHOD"})` | THREW |
| `http.request(new URL("http://h/"), {method: "BAD METHOD"})` | THREW |
## What this decides, and what it deliberately does not
Only shapes where the copied value is certainly the syntactic one:
- slot 0 is an options literal, or
- slot 0 is a string, a template or a verified `new URL`, so the `(url, options)` overload is proven
Every other shape keeps the request. Each of these was measured and can put something else in the
slot or change the copied value:
| call | outcome | why undecided here |
| --- | --- | --- |
| `http.request(() => {}, {method: "BAD METHOD"})` | request constructed | slot 0 is the callback, slot 1 unread |
| `https.request(null, {method: "BAD METHOD"})` | request constructed | `https` keeps its default options for a falsy input |
| `{get x() { this.method = "GET"; }, method: "BAD METHOD"}` | request constructed | the getter runs before the copy |
| `{method: "BAD METHOD", get x() { this.method = "GET"; }}` | THREW | getter after the copy cannot rescue it, but this reader does not model copy order |
| `{...{host: "h"}, method: "BAD METHOD"}` | THREW | a spread may replace the member |
The last two are the honest gap in this change. Closing them needs `Object.assign`'s enumeration
order — integer keys first, first-insertion position for a redefined key — which is a different
piece of work and belongs in its own change rather than widening this one.
Keeping a request Node never makes is the safer direction, and it is the direction I chose
wherever the copy is not certainly the literal.
## Contract and boundary impact
- Semantic owner and earliest changed stage: request candidate collection in the JavaScript domain.
- CLI and MCP/tool-catalog contract: none.
- Provider, bridge, target-format, or platform compatibility: `fetch` and `WebSocket` keep their
existing behavior; both use a different member and do not validate a token.
- Evidence, artifact, provenance, or reconstruction contract: a refused call no longer reports a
request operation or its linked release.
- Generated metadata, package, or installation impact: none.
Expected effects:
- [x] Analysis facts only; no target interaction.
## Validation performed
- 15 cases in `javascriptSemanticAnalysis.http_method_token.test.ts`; reverting the reader fails 5.
- `src/domain/javascript` — 5644 passing.
- `npm run format:check` — exit 0.
- `npm run lint` — 0 errors.
## Before merge
- [x] This PR addresses a concrete problem or an agreed enhancement.
- [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
- [x] The PR has one focused outcome and the title follows `type(scope): outcome`.
- [x] Tests cover changed observable behavior and meaningful failure paths.
- [x] Owning docs, contracts, and generated metadata are updated where needed.
- [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
## Author readiness
Human owner: @XiaoBinGan
- [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
- [x] I checked the evidence above, confirm it supports the current change, and recorded meaningful validation gaps.
- [x] I declare this PR ready for initial maintainer review.
d7355cd to
17e9047
Compare
A review finding, measured on Node 24.22.1. `ClientRequest` copies the options with
`Object.assign`, so a getter enumerated before `path` runs first and can rewrite the value that
is then validated:
| call | outcome |
| --- | --- |
| `{get agent() { this.path = "/ok"; return undefined; }, path: "/a b"}` | request constructed |
| `{path: "/a b", get agent() { this.path = "/ok"; }}` | THREW `ERR_UNESCAPED_CHARACTERS` |
`optionGetterPrecedesMember` compares enumeration order rather than source order, because
`Object.assign` does not follow the source: an ECMAScript array index comes first and a redefined
key keeps its first insertion position while its descriptor comes from the last write.
Note for merge order: morluto#9683 carries the same ordering rule for `options.method` on this file. If
that lands first, `methodGetterPrecedesMember` and this helper are the same function and should be
collapsed into one.
`src/domain/javascript`: 5422 passing. Reverting the reader fails 2 of the new cases.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17e90478cc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
A review finding, measured on Node 24.22.1. `_` is an RFC 9110 `tchar`, and the class I wrote
omitted it, so a valid method was reported as refused:
| call | outcome |
| --- | --- |
| `http.request({method: "M_SEARCH"})` | request constructed |
| `http.request({method: "X_CUSTOM"})` | request constructed |
| `http.request({method: "_"})` | request constructed |
| `http.request({method: "M-SEARCH"})` | request constructed |
| `http.request({method: "A B"})` | THREW `ERR_INVALID_HTTP_TOKEN` |
The class now matches RFC 9110 exactly. Three cases pin the characters a hand-written class is
most likely to drop: `_`, and the `-` that was already present.
`src/domain/javascript`: 5665 passing.
e5d5d5f to
6383983
Compare
|
Fixed in
The class matches RFC 9110 exactly now, and three cases pin the characters a hand-written class is Worth saying: this is the second time in this PR that a hand-written spelling of a standard |
|
Re-checked against
|
|
TL;DR: On Node 22.23.4, 24.22.1 and 26.12.1, all 18 tests in the PR's test file passed. With the old source file put back, 5 of the 18 tests failed on each version. The head is 1769 commits behind main; I did not test a merge. FindingsI ran the PR's changed test file,
The 5 failing cases: CI on head 6383983 reads mergeable true, state clean, not a draft.
Not run
Test setupCommandsnpm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- src/domain/javascript/javascriptSemanticAnalysis.http_method_token.test.ts🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
gensokyo-dev
left a comment
There was a problem hiding this comment.
Verified: the tests for this change pass locally and CI is green. The change is limited to the rule described above, and other cases keep their existing behavior. Thanks.
* fix(javascript): reject an http path Node refuses at the call site `http.request` and `https.request` validate `options.path` before they build the request, so a literal carrying an unescaped character throws `ERR_UNESCAPED_CHARACTERS` from the call itself and no request exists. The analysis reported one anyway. The accepted set was measured rather than guessed: every ASCII code point was placed inside a literal path on Node 24.22.1 and exactly `0x00`-`0x20` are refused while `0x21`-`0x7f` are accepted. That makes it a closed range, not a list of known-bad characters, and three consequences follow that a hand-written list would get wrong: | `options.path` | outcome | | --- | --- | | `"/a b"`, `" "`, `"\t"`, `"\n"`, `"\u0000"` | THREW `ERR_UNESCAPED_CHARACTERS` | | `"/a%20b"` | request constructed — the escape is what the literal above should have been | | `"/aéb"` | request constructed — non-ASCII is inside the accepted range | | `""` | request constructed — Node reads it as "not given" and falls back to `/` | `fetch` reads a different member and validates no path. A spread argument or a binding leaves the answer to the runtime, the same rule the sibling overload-slot readers use. 14 cases, 7 failing before this commit. `src/domain/javascript`: 5372 to 5386 passing. `tsc` reports only the pre-existing `adbCommands.ts` duplicate `packageName`, which `main` already has and `#9677`/`#9678` fix. * fix(javascript): bound the accepted http path range at Latin-1 A reviewer caught that my "non-ASCII is accepted" claim was not established: I had probed ASCII plus `U+00E9` and generalised from two data points. Probing the upper bound on Node 24.22.1 shows the accepted range is exactly `U+0021`-`U+00FF`: | `options.path` | outcome | | --- | --- | | `U+007F`, `U+00A0`, `U+00E9`, `U+00FF` | request constructed | | `U+0100`, `U+1000`, `U+4E00`, `U+2028`, `U+1F600`, `U+10FFFF` | THREW `ERR_UNESCAPED_CHARACTERS` | | `0x00`-`0x20` | THREW `ERR_UNESCAPED_CHARACTERS` | So the rule is a closed **Latin-1** range, not ASCII and not a list of known-bad characters. `path: "/aĀb"` throws, and the previous regex emitted a request for it. `/[^\u0021-\u00ff]/u` is the range, and four above-Latin-1 cases plus three inside-Latin-1 controls now pin both ends. 21 cases; reverting the pattern fails the new upper-bound cases. `src/domain/javascript`: 5400 passing. * fix(javascript): restrict the spread bailout to the options slot A reviewer caught that the spread bailout was too wide. Expanding a later argument cannot change an object Node already picked, so the call still throws: | call | Node 24.22.1 | | --- | --- | | `http.request({path: "/a b"}, ...callbacks)` | THREW `ERR_UNESCAPED_CHARACTERS` | | `http.request("http://h/", {path: "/a b"}, ...callbacks)` | THREW `ERR_UNESCAPED_CHARACTERS` | | `http.request(...[{host}], {path: "/a b"})` | THREW `ERR_INVALID_ARG_TYPE` — the spread decides slot 0 | Only a spread at or before the options slot can move it, so the loop now checks just those indices. The previous version kept a request for either of the first two calls. 24 cases; reverting the loop to the blanket bailout fails 2 of them. `src/domain/javascript`: 5407 to 5410 passing. * fix(javascript): read slot 1 only for a proven url overload A non-object first argument is the options slot only for Node's `(url, options)` overload. Measured on Node 24.22.1, `http.request(() => {}, {path: "/a b"})` builds a request to `/`, because `ClientRequest` reads the function as the callback and replaces options with defaults — the second object is never read. The previous version read that object and dropped a real request. `optionsIndex` now requires a string, a no-substitution template or `new URL` before it looks at slot 1; anything else is unresolved and keeps the request. Both directions are covered: `http.request("/x", {path: "/a b"})` and `http.request(new URL("http://h/"), {path: "/a b"})` still throw, so the URL overload is not weakened. 3 cases added; `src/domain/javascript`: 5410 passing. * fix(javascript): verify the URL constructor before reading the options slot A review finding, measured on Node 24.22.1. The `new URL` arm tested the callee by name: | call | outcome | | --- | --- | | `const URL = Function; http.request(new URL(), {path: "/a b"})` | default `/` request — slot 0 is a function, so it is the callback | | `http.request(new URL("http://h/"), {path: "/a b"})` | THREW `ERR_UNESCAPED_CHARACTERS` | `isUnmodifiedGlobalReference(callee, state, "URL")` replaces the name test, so a replaced `URL` no longer proves the `(url, options)` overload. `rejectsHttpPathLiteral` takes the analysis state for that, which is the same guard the file already uses for `JSON.parse`. `src/domain/javascript`: 5413 passing. * fix(javascript): let an earlier getter decide the path A review finding, measured on Node 24.22.1. `ClientRequest` copies the options with `Object.assign`, so a getter enumerated before `path` runs first and can rewrite the value that is then validated: | call | outcome | | --- | --- | | `{get agent() { this.path = "/ok"; return undefined; }, path: "/a b"}` | request constructed | | `{path: "/a b", get agent() { this.path = "/ok"; }}` | THREW `ERR_UNESCAPED_CHARACTERS` | `optionGetterPrecedesMember` compares enumeration order rather than source order, because `Object.assign` does not follow the source: an ECMAScript array index comes first and a redefined key keeps its first insertion position while its descriptor comes from the last write. Note for merge order: #9683 carries the same ordering rule for `options.method` on this file. If that lands first, `methodGetterPrecedesMember` and this helper are the same function and should be collapsed into one. `src/domain/javascript`: 5422 passing. Reverting the reader fails 2 of the new cases. * fix(javascript): walk a statically inert options spread A review finding, measured on Node 24.22.1. An object-literal spread materializes its own keys as data properties at its position, so it neither hides the member nor adds a getter: | call | outcome | | --- | --- | | `http.request({...{host: "h"}, path: "/a b"})` | THREW `ERR_UNESCAPED_CHARACTERS` | | `http.request({...{path: "/a b"}, host: "h"})` | THREW | | `http.request({...{}, path: "/a b"})` | THREW | | `http.request({...{get x() {}}, path: "/a b"})` | request constructed — the getter runs | The order model skipped every spread and bailed out, so the first three kept a request Node never creates. It now walks an object-literal spread: each entry takes the spread's position, a getter inside the spread still bails, and a spread this reader cannot expand keeps the request. The other finding on this PR — an own `__proto__` data key before `path` — does not reproduce. `Object.assign({}, options)` does run the setter, but `http.request` validates the literal before that copy: | call | Node 24.22.1 | | --- | --- | | `http.request({["__proto__"]: {set path(_) {}}, path: "/a b"})` | THREW `ERR_UNESCAPED_CHARACTERS`, setter never called | | `const c = Object.assign({}, {...}); http.request(c)` | OK — the setter consumed the path | So the existing rejection is correct for the call shape this reader sees, and only a pre-copied object changes the answer. I have replied on that thread with the reproduction rather than changing the reader. `src/domain/javascript`: 5660 passing. * fix(javascript): give a spread member its own insertion position A review finding, measured on Node 24.22.1. Every key a spread contributed was recorded at the spread's outer index, so a key redefined later lost the position it kept at runtime: `http.request({...{agent: null, path: "/a b"}, get agent() { this.path = "/ok"; return false; }})` constructs a request, because `agent` takes the spread's position, the redefinition keeps it, and the getter therefore runs before `path` is copied. Positions are a running counter now, advanced for each contributed key, so a spread's members keep their order relative to each other and to the members written after the spread. `src/domain/javascript`: 5673 passing. * fix(javascript): keep a getter a later setter does not remove A review finding, measured on Node 24.22.1. An object literal merges `get x` and `set x` into one accessor descriptor, so a later `set` entry does not take the getter away: `http.request({get agent() { this.path = "/ok"; }, path: "/a b", set agent(_) {}})` constructs a request, because the getter still runs before `path` is copied. The order model kept only the last node per key, so the `set` entry replaced the `get` and the getter disappeared from the scan. Getter keys are accumulated separately now, so a paired setter cannot erase one. `src/domain/javascript`: 5666 passing. * fix(javascript): clear a getter fact a data property replaces A review finding, measured on Node 24.22.1. A key's descriptor is whatever the literal leaves there, so a later data entry removes the getter that an earlier one installed: | call | outcome | | --- | --- | | `http.request({get agent() { this.path = "/ok"; }, path: "/a b"})` | request constructed | | `http.request({get agent() { this.path = "/ok"; }, path: "/a b", agent: null})` | THREW `ERR_UNESCAPED_CHARACTERS` | | `http.request({get agent() { this.path = "/ok"; }, path: "/a b", set agent(_) {}})` | request constructed | The getter set only grew, so a redefinition left a fact that no longer held and emitted a phantom request. A data entry clears the key now; a setter does not, because `get x` and `set x` merge into one accessor descriptor instead of replacing each other. `src/domain/javascript`: 5667 passing. * fix(javascript): keep a request when a computed key could hold a getter's position * fix(javascript): skip a spread's prototype setter so an outer getter's fact survives * fix(javascript): retain effective option descriptors * fix(javascript): follow Node request option evaluation * test(javascript): expect known invalid copied methods * test(javascript): distinguish global effect activations --------- Co-authored-by: 吴佳浩 <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
Summary
http.requestandhttps.requestvalidateoptions.methodwithcheckIsHttpTokenbefore they build the request, so a literal outside the token set throwsERR_INVALID_HTTP_TOKENfrom the call itself and no request exists. The analysis reported one anyway.Measured on Node 24.22.1
options.method"GET","get","M-SEARCH","X","!#$%&'*+-.^_`|~"""GET"BAD METHOD","G/ET","G:ET","G,ET","GET "," ","\t","GéT"ERR_INVALID_HTTP_TOKENTwo consequences worth naming:
"GET "fails on the trailing space while"get"and"M-SEARCH"pass.""as "not given" rather than as an invalid token. Treating it as invalid would drop a real request.fetchandWebSocketread a different member and validate no token, so they are untouched. A non-stringmethodthrowsERR_INVALID_ARG_TYPE, but that is left undecided because the reported fields do not describe the type check.Contract and boundary impact
Expected effects:
Validation performed
src/domain/javascript— 5402 passed.npm run format:check— exit 0 for the files this PR touches. The reported issue is insrc/cli/adbCommands.ts.npm run lint— the one error is theadbCommands.tsduplicate declaration below.npm run build— fails only on that sameadbCommands.tserror.tsc,lintandbuildall fail onsrc/cli/adbCommands.ts(46,9): error TS2451: Cannot redeclare block-scoped variable 'packageName', whichmainate9b6c87c1already has and which this PR does not touch.#9677and#9678are open fixes for it. I did not include it here so this PR keeps one outcome.Before merge
type(scope): outcome.Author readiness
Human owner: @XiaoBinGan