Closed Bug 2061626 Opened 3 months ago Closed 15 days ago

TCPSocket reports incorrect TCPReadyState causing misleading logs and harm to SMTP

Categories

(Core :: DOM: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: maxe, Assigned: jesup)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged][necko-priority-queue])

Attachments

(1 external file)

To remind everything, these are the available options:

enum TCPReadyState {
  "connecting",
  "open",
  "closing",
  "closed",
};

I noticed two correctness issues with this.

A:
State: Connecting during proxy lookup AsyncResolve
Expected result: connecting
Actual result: closed

B:
State: Connecting to SSL/TLS using useSecureTransport: true, TCP established, TLS still in flight
Expected result: connecting
Actual result: open

I would like to see them fixed in one go, B is much more severe than A because an open TCP session can easily happen with some kind of middlebox or incorrect server before TLS is established.

Blocks: 2061922
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-queue]
Assignee: nobody → rjesup

Two correctness issues:

  • readyState stayed "closed" instead of "connecting" while the proxy
    lookup for a new connection was in flight, because ResolveProxy() left
    mReadyState at its constructor default until the async lookup completed.
  • With useSecureTransport, readyState jumped to "open" (and the "open"
    event fired) as soon as the TCP handshake completed, even though the TLS
    handshake was still in progress. An open TCP session before TLS is
    established can happen with a misbehaving middlebox or server, so this
    is the more severe of the two.

Set mReadyState at the start of ResolveProxy(), and for secure sockets
defer the transition to "open" from STATUS_CONNECTED_TO to
HandshakeDone(), reported via nsITlsHandshakeCallbackListener.

There is an r+ patch which didn't land and no activity in this bug for 1 week.
:jesup, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(rjesup)
Status: NEW → RESOLVED
Closed: 15 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
Regressions: 2091547
Flags: needinfo?(rjesup)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: