Repository navigation
fix(main): let Stop and timeouts end a pending DNS lookup - #254
Merged
Merged
Conversation
- The desktop HTTP/SSE and WebSocket transports awaited the destination lookup without their abort signal, so a resolver that never answered delayed Stop and the request deadline indefinitely. - resolveGuardedNetworkTarget accepts the caller's signal and settles with the caller's cancel or timeout, never a policy rejection. HTTP passes its request controller; WebSocket bounds the lookup with the same Stop and deadline it already applies to the connection. - Build WebSocket handshake headers on a null-prototype object so a header named __proto__ is sent instead of silently dropped. Changelog: none
- HttpRequestHeader has no id field; typecheck:tests rejected the literal. Changelog: none
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.
Summary
Two follow-ups from the October review of the desktop network guard (
src/main/networkTargetPolicy.ts):resolveGuardedNetworkTargetawaiteddns.lookupwith no abort signal. HTTP/SSE only armed its abort on the laterfetch, and WebSocket only after the lookup, so a resolver that never answered kept the request alive past Stop and past its timeout.signaland races the lookup against it. An aborted lookup rethrows the caller's abort, never anSsrfBlockedError, so transports keep classifying it as cancel or timeout.httpProxy.tspasses its request controller.httpWebSocket.tsbounds the lookup with the same Stop andtimeoutMsit already uses for the connection; the result is "Request cancelled" ortimeout, matching its existing messages.__proto__WebSocket header.toHeaderRecordbuilt a plain object, so assigning a header named__proto__changed the prototype instead of adding a header, and it was silently dropped. The record is now null-prototype (the same class of bug fixed inurlParse).The DNS phase gets its own
timeoutMsbudget before the connection's; previously it had none.Validation
__proto__header received on the wire by a realwsserver (checked viarawHeaders). All three fail without the fix; two of them hang until the test timeout.tests/main+tests/ipc: 1060 passed;tsc --noEmit, lint,changelog:checkgreen.pnpm run smoke:desktop:stagewright: launch + snapshot, 0 console errors. It does not exercise a hanging resolver; the transport tests cover that path.