Commit graph

628 commits

Author SHA1 Message Date
Cecylia Bocovich
3844122809 Merge branch 'ticket30206' 2019-05-08 17:46:33 -04:00
Cecylia Bocovich
695dd10b2c Fix for ticket #30206
This fixes a bug introduced by the deadlock patch for ticket #25688.
2019-05-08 17:45:55 -04:00
Cecylia Bocovich
83fb5df260 Fixed log scrubber to not scrub timestamps
Our log scrubber was a bit over-zealous and was scrubbing timestamps as
well. While we're still over-scrubbing, we're now more precise and
ensure that compressed IPv6 addresses have "::"
2019-05-08 12:31:53 -04:00
Arlo Breault
e7f3ade068 Add a WebExtUI the makes use of the new assests
The browser icon shows the on/off state.
2019-05-08 11:23:49 -04:00
Arlo Breault
2b1852c1a5 Make badge and debug extend ui
Permits further ui extension
2019-05-08 11:23:49 -04:00
Arlo Breault
5b18729e77 Add new assets
From https://trac.torproject.org/projects/tor/ticket/23888#comment:5
2019-05-08 11:23:49 -04:00
Arlo Breault
49dedf3a2f Start a webextension 2019-05-08 11:23:49 -04:00
Arlo Breault
5aca6028f9 Stop logging debug message while counting down 2019-05-08 11:23:49 -04:00
Arlo Breault
898ba57070 Make a few object literals classes 2019-05-08 11:23:49 -04:00
Arlo Breault
7ce3c83a31 Use some class vars in broker to eliminate globals 2019-05-08 11:23:49 -04:00
Arlo Breault
bd5887a876 Make a WS class to eliminate globals 2019-05-08 11:23:49 -04:00
Arlo Breault
f3254e3402 Remove Modernizr dependency
And inline its only use site.
2019-05-08 11:23:49 -04:00
Arlo Breault
25dac378ee Move init into its own file 2019-05-08 11:23:49 -04:00
Arlo Breault
622005c79e Remove copy/paste signalling 2019-05-08 11:21:56 -04:00
Arlo Breault
79c84509fc Follow go-webrtc commit 6c3076c and switch to xenial in .travis.yaml 2019-04-30 15:31:30 -04:00
Cecylia Bocovich
171c55a9b1 Implemented geoip lookups for the snowflake broker. This heavily based off of how tor maps IP addresses to country codes, and relies on the provided ipv4 and ipv6 files. 2019-04-29 17:10:15 -04:00
Cecylia Bocovich
d11e55aabe Merge branch 'ticket30125' 2019-04-16 12:59:56 -04:00
Cecylia Bocovich
d4c5d4e65b Updated robots.txt handler on broker
Updated robots.txt file to disallow crawling as in ticket #29565.
2019-04-15 16:43:21 -04:00
Cecylia Bocovich
b4a4a256db Ported log sanitization to client 2019-04-12 09:52:23 -04:00
Cecylia Bocovich
482d60d9d3 Use safelog scrubber in broker and proxy-go 2019-04-11 14:47:31 -04:00
Cecylia Bocovich
49042511a3 Refactored server log scrubber into package
The server log scrubbing code from ticket #21304 is now refactored into
a safelog package, along with the appropriate tests
2019-04-11 14:43:59 -04:00
Cecylia Bocovich
6399ef9d4f Merge branch 'deadlock' 2019-04-11 09:57:38 -04:00
Cecylia Bocovich
62fddab153 Moved data channel timeout to constant 2019-04-05 10:40:11 -04:00
Cecylia Bocovich
08f5205461 Added check to see if peer connection succeeded
This is related to the proxy-go deadlock bug #25688. If a client doesn't
do anything with the SDP answer, a token will get lost. Added a timeout
after a minute that checks the PeerConnection state and destroys the
peer connection and returns a token if did not yet succeed
2019-04-03 15:59:47 -04:00
Cecylia Bocovich
c28c8ca489 Fix for proxy deadlock bug
This is a fix for the proxy-go deadlock bug (ticket #25688). The
assumption that OnIceComplete is always followed by a successful
connection where OnDataChannel has been called turns out not to occur in
practice. OnICEComplete looks like it is being deprecated in other
libraries anyway, so it's safer to just remove it.
2019-04-03 13:44:48 -04:00
Cecylia Bocovich
3eb9064438 Removed unecessary output from logs
Removed raw bytes of ICE answers from broker logs and the SDP stanzas
from the client logs
2019-03-25 15:15:22 -04:00
Cecylia Bocovich
611cb889c5 Made regular expressions more precise
Modified regular expressions to not scrub fingerprints, but catch all
instances of IPv4 and IPv6 addresses. Expanded test cases with those
suggested by dcf.
2019-03-25 15:06:17 -04:00
Cecylia Bocovich
c6a4a4191f Modified log scrubber to handle split lines
Log scrubber now scrubs addresses even in the case where they are split
across calls to the scrubber's output io.Writer.

Added test cases to test that the writer behaves correctly across split
lines.
2019-03-25 15:06:08 -04:00
Cecylia Bocovich
1ea467c4cf Restructured scrubbing code and tests
It is now more readable, and the regexp's are only compiled once
2019-03-25 15:05:58 -04:00
Cecylia Bocovich
5bc8817028 Simplified log scrubber
IPv6 regexes didn't need to be that precise, added more tests for
edge-cases.
2019-03-25 15:05:47 -04:00
Cecylia Bocovich
f586a4bab8 Sanitize IP addresses from server log output
Added a scrubber that takes all logging output to the standard logger
and passes through a series of regular expressions to replace IP
addresses with safe strings (e.g., X.X.X.X:443).

Ensure server logs to stdout are also scrubbed
2019-03-25 15:05:31 -04:00
David Fifield
88f282c733 Link to the snowbox test environment. 2019-03-07 11:01:29 -07:00
David Fifield
bf82ef5192 Bump last updated date. 2019-01-22 11:26:45 -07:00
David Fifield
627f37e004 Move the Yes/No buttons into index.html; redirect options.html to it. 2018-12-20 20:50:39 -07:00
David Fifield
9e2a85d753 Bump last updated date. 2018-12-20 20:48:50 -07:00
David Fifield
27b74b1666 Use a relative URL for the embed in the sample page.
To facilitate local testing.
2018-12-20 20:48:22 -07:00
David Fifield
82b696709d Escape quoted HTML markup within textarea. 2018-12-20 20:14:47 -07:00
David Fifield
5667aa8ebb Fix HTML tag typo. 2018-12-20 18:29:51 -07:00
David Fifield
9e47cc3b5b .gitignore broker/broker. 2018-12-20 16:40:30 -07:00
David Fifield
01bdcd6b28 Bump last updated date. 2018-12-19 21:34:06 -07:00
David Fifield
ab34f8e889 Use chunk.byteLength as appropriate for ArrayBuffers.
Without this, running with non-dummy rate limiter (e.g. ?ratelimit=1000)
would try to add undefined to a number resulting in NaN.
2018-12-19 21:30:39 -07:00
David Fifield
297ae7b1b8 Test ProxyPair with ArrayBuffers, not strings. 2018-12-19 21:30:39 -07:00
David Fifield
7c519b2975 Log WebSocket→WebRTC messages in debug mode.
Same as the other direction.
2018-12-19 21:30:39 -07:00
David Fifield
f06104d182 Only console.log the number of bytes, not the literal message.
It doesn't really help to have a bunch TLS application records
interpreted as a string written to the console.
2018-12-19 21:30:39 -07:00
David Fifield
aa668bdc92 Set binaryType="arraybuffer" for RTCDataChannel, just as with WebSocket.
The binaryType can be "arraybuffer" or "blob", and "blob" is the
default. The code is only aware of "arraybuffer": I discovered a problem
while running snowflake.html in debug mode; this code fails:
    if DEBUG
      # Go sends only raw bytes...
      if '[object ArrayBuffer]' == recv.toString()
        bytes = new Uint8Array recv
        line = String.fromCharCode.apply(null, bytes)
      line = line.trim()
      log 'WebRTC --> websocket data: ' + line
with the error:
	TypeError: line.trim is not a function[Learn More] snowflake.js:497:16
because recv is of type Blob, not ArrayBuffer.

Despite the unexpected type, the code seemed to work as expected when
not in debug mode. Though the two types provide different interfaces,
they are both valid to pass on to WebSocket.send. The only other thing
we did with it was try to read the .length member for rate-limiting
purposes:
        @rateLimit.update chunk.length
but .length is incorrect for either type: Blob uses .size and
ArrayBuffer uses .byteLength. It worked anyway, because
DummyRateLimit.update doesn't actually look at its argument.

We were already setting binaryType="arraybuffer" for WebSocket
connections.
2018-12-19 21:30:39 -07:00
David Fifield
a554439370 Link to #26360 for why we blackhole logs without -log.
Maybe we'll able to remove this in the far future.
2018-12-18 21:24:32 -07:00
David Fifield
a48b704788 Remove "broker" and "relay" query params in proxy/README.
Addendum to #28727.
2018-12-05 13:40:17 -07:00
David Fifield
52e79a4b43 Bump last updated date. 2018-12-05 13:39:01 -07:00
David Fifield
debe9c3748 Bug 28727: remove "broker" and "relay" query string parameters.
These could be misused to cause Snowflake proxies to attempt connect to
unsuspecting third parties.
https://bugs.torproject.org/28727
2018-12-05 13:35:03 -07:00
David Fifield
5817c257c1 Fix a local variable reference in BucketRateLimit.when.
ReferenceError: age is not defined	snowflake.js:265:7
        BucketRateLimit.prototype.when	snowflake/proxy/build/snowflake.js:265:7
        ProxyPair.prototype.flush	snowflake/proxy/build/snowflake.js:558:63
        bind/<	snowflake/proxy/build/snowflake.js:10:56
        ProxyPair.prototype.onClientToRelayMessage	snowflake/proxy/build/snowflake.js:495:14
        bind/<	snowflake/proxy/build/snowflake.js:10:56
2018-12-04 17:14:35 -07:00