[tor-bugs] #28726 [Obfuscation/Snowflake]: Loosen restrictions on message sizes in WebSocket server

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Dec 5 18:32:50 UTC 2018


#28726: Loosen restrictions on message sizes in WebSocket server
-----------------------------------+------------------------
 Reporter:  dcf                    |          Owner:  (none)
     Type:  defect                 |         Status:  new
 Priority:  Medium                 |      Milestone:
Component:  Obfuscation/Snowflake  |        Version:
 Severity:  Normal                 |     Resolution:
 Keywords:                         |  Actual Points:
Parent ID:                         |         Points:
 Reviewer:                         |        Sponsor:
-----------------------------------+------------------------

Comment (by dcf):

 I ran a browser proxy for a day and a half, with a patch to keep track of
 the size of WebSocket messages it was sending. I only got 5 or 6 sessions,
 but I didn't see any sends bigger than 32 KB. And messages that big only
 happened once the session was pretty well established, not at the
 beginning during bootstrapping. (Which makes sense, because the client
 doesn't upload much during bootstrapping.)

 So while we could probably benefit from raising the limit a little, it
 doesn't seem so constraining that it would cause bootstrapping errors most
 of the time. Maybe a faster or slower network would have different
 buffering behavior and give different results, though.

 {{{
 new max message size 3656

 new max message size 5227

 new max message size 4077

 new max message size 7283

 new max message size 11909
 new max message size 23940
 new max message size 25418
 new max message size 32768
 }}}

 Here is the patch I used (applied on top of #28732 patches):
 {{{#!patch
 --- a/proxy/proxypair.coffee
 +++ b/proxy/proxypair.coffee
 @@ -21,6 +21,7 @@ class ProxyPair
    flush_timeout_id: null
    onCleanup:   null
    id:          null
 +  max_message_size: 0

    ###
    Constructs a ProxyPair where:
 @@ -134,6 +135,9 @@ class ProxyPair
    onClientToRelayMessage: (msg) =>
      if DEBUG
        log 'WebRTC --> websocket data: ' + msg.data.byteLength + ' bytes'
 +    if msg.data.byteLength > @max_message_size
 +      @max_message_size = msg.data.byteLength
 +      log 'new max message size ' + @max_message_size
      @c2rSchedule.push msg.data
      @flush()

 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/28726#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list