Commit graph

435 commits

Author SHA1 Message Date
Arlo Breault
5384ef9d16 Fix some linting warnings for "Unnecessary fat arrow." 2019-05-16 12:07:06 -04:00
Arlo Breault
4d40f17487 Separate build per use 2019-05-16 12:07:06 -04:00
Arlo Breault
2d8a1690ba Initialize snowflake instance with a config 2019-05-16 12:07:06 -04:00
Arlo Breault
edbbea1d03 Move querystring access to init 2019-05-16 12:07:06 -04:00
Arlo Breault
3839c2e0b1 Initialize arrays when constructing
Otherwise, this is set on the prototype and shared across instances :/

Note the change to the test that highlights this bug.  A proxy pair was
already created when an earlier test called `beginWebRTC()` but a new
Snowflake instance should start with an empty array.
2019-05-16 12:07:06 -04:00
Arlo Breault
9df66b15b1 Make MODE a class constant 2019-05-16 12:07:06 -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
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
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
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
David Fifield
9545be1c9f '//' is not a CSS comment.
I got the warning:
	Expected declaration but found ‘/’.  Skipped to next declaration.
2018-12-04 15:46:12 -07:00
David Fifield
3cd8519ec9 Fix the ProxyPair tests exposed by the previous commit.
This was mainly a matter of more complete mocking.
2018-12-04 15:09:53 -07:00
David Fifield
fce32bf292 Fix nested Jasmine tests.
You can nest a "describe" in a "describe":
  describe
    describe
      it

But you can't nest an "it" in an "it":
  describe
    it
      it

The nested "it"s were not getting run (or getting run, but their output
ignored, I'm not sure).

Before this change:
	41 specs, 0 failures
After:
	44 specs, 5 failures
2018-12-04 15:09:53 -07:00
David Fifield
261ef8f5bc Remove duplicate ProxyPair tests from util.spec.coffee. 2018-12-04 15:09:53 -07:00
David Fifield
fd9efa1001 Fix text-shadow CSS.
The semicolons made it look like the end of a declaration. I got these
errors in the Firefox console:

Expected declaration but found ‘1px’.  Skipped to next declaration. 1 embed.html:29:17
Expected declaration but found ‘-1px’.  Skipped to next declaration. 1 embed.html:30:17
2018-04-17 17:21:46 -07:00
Arlo Breault
433a47fdf7 Only unset the header for the page being rendered 2018-04-17 16:43:01 -04:00
Arlo Breault
b441ae4bf4 Add an .htaccess file to unset X-Frame-Options 2018-04-17 16:05:39 -04:00
David Fifield
947636ae81 Change to standalone broker.
https://snowflake-reg-test.appspot.com/ for the client (needs domain fronting)
https://snowflake-broker.bamsoftware.com/ for the proxies (no fronting)

Note that fronting to App Engine doesn't currently actually work because
of https://bugs.torproject.org/25804; this commit doesn't change that.
2018-04-16 10:24:00 -07:00
David Fifield
a9630a8234 keroserene.net/snowflake → snowflake.torproject.org 2018-04-16 10:24:00 -07:00
David Fifield
a762becbaa Link to wiki page rather than github source code.
I'm intuiting that the purpose of linking to github was to show the
README, not to link to the source code per se, so I changed the link to
point to the wiki page rather than gitweb.torproject.org/....

https://bugs.torproject.org/23947#comment:15
2018-04-16 10:24:00 -07:00
David Fifield
9f1c7b12c8 Link to Snowflake wiki page rather than mailing list post.
The wiki page in turn links to the post.
2018-04-15 17:36:53 -07:00
David Fifield
933c117a48 Declare utf-8 in index.html. 2018-04-15 17:32:36 -07:00
David Fifield
5a1dffcceb Update "last updated" date; remove "~Serene" signoff. 2018-04-15 17:25:10 -07:00
David Fifield
bcef2ee7fb Add <title> to index.html and snowflake.html. 2018-04-15 17:23:16 -07:00
David Fifield
01d1f951e5 Add the cake build hint to proxy/README.md.
It was already in the root README.md, but proxy/README.md is where I
always look for it.
2018-04-15 17:13:26 -07:00
David Fifield
2e59838faf Documentation fix: current default relay.
Was missed in 3fe10f3e7c.
2018-04-15 17:07:32 -07:00
Arlo Breault
c62111c507 Freeze jasmine until tests are updated for newer version 2018-03-05 20:40:47 -05:00