signal-desktop/js
Lilia 50c470e53d
Certificate pinning via node XMLHttpRequest implementation (#1394)
* Add certificate pinning on https service requests

Make https requests to the server using node apis instead of browser apis, so we
can specify our own CA list, which contains only our own CA.

This protects us from MITM by a rogue CA.

As a bonus, this let's us drop the use of non-standard ports and just use good
ol' default 443 all the time, at least for http requests.

// FREEBIE

* Make certificateAuthorities an option on requests

Modify node-based xhr implementation based on driverdan/node-XMLHttpRequest,
adding support for setting certificate authorities on each request.

This allows us to pin our master CA for requests to the server and cdn but not
to the s3 attachment server, for instance. Also fix an exception when sending
binary data in a request: it is submitted as an array buffer, and must be
converted to a node Buffer since we are now using a node based request api.

// FREEBIE

* Import node-based xhr implementation

Add a copy of https://github.com/driverdan/node-XMLHttpRequest@86ff70e, and
expose it to the renderer in the preload script.

In later commits this module will be extended to support custom certificate
authorities.

// FREEBIE

* Support "arraybuffer" responseType on requests

When fetching attachments, we want the result as binary data rather than a utf8
string. This lets our node-based XMLHttpRequest honor the responseType property
if it is set on the xhr.

Note that naively using the raw `.buffer` from a node Buffer won't work, since
it is a reuseable backing buffer that is often much larger than the actual
content defined by the Buffer's offset and length.

Instead, we'll prepare a return buffer based on the response's content length
header, and incrementally write chunks of data into it as they arrive.

// FREEBIE

* Switch to self-signed server endpoint

* Log more error info on failed requests

With the node-based xhr, relevant error info are stored in statusText and
responseText when a request fails.

// FREEBIE

* Add node-based websocket w/ support for custom CA

// FREEBIE

* Support handling array buffers instead of blobs

Our node-based websocket calls onmessage with an arraybuffer instead of a blob.
For robustness (on the off chance we switch or update the socket implementation
agian) I've kept the machinery for converting blobs to array buffers.

// FREEBIE

* Destroy all wacky server ports

// FREEBIE
2017-09-14 17:03:17 -07:00
..
models Remove dead code 2017-09-14 16:53:45 -07:00
views Import: Wait until db writes resolve before saying we're done (#1401) 2017-09-14 17:03:17 -07:00
background.js Certificate pinning via node XMLHttpRequest implementation (#1394) 2017-09-14 17:03:17 -07:00
backup.js Separate dir selection from import, better import button text 2017-09-14 17:02:46 -07:00
chromium.js Remove extension.notification 2017-09-14 16:53:45 -07:00
components.js Introduce new filesize dependency 2017-05-09 15:14:20 -07:00
conversation_controller.js Remove dead code 2017-09-14 16:53:45 -07:00
database.js Flatten database migrations 2017-09-14 16:53:39 -07:00
debugLog.js Note how many debug logs we have after we load them from DB 2017-09-14 16:53:52 -07:00
delivery_receipts.js Additional logging when we get delivery receipt for unknown msg 2017-08-23 13:39:29 -07:00
emoji_util.js Use relative paths 2017-09-14 16:53:34 -07:00
expire.js Build expiration date 2017-09-14 16:53:38 -07:00
expiring_messages.js Fetch all conversations on startup of app, not on inbox load (#1437) 2017-09-06 18:18:46 -07:00
focus_listener.js Move focus listeners to their own file 2017-09-14 16:53:37 -07:00
i18n.js Use correct locale, fall back to en if we don't have translations 2017-09-14 16:53:47 -07:00
keychange_listener.js Fetch conversations once, clean up ConversationController API (#1420) 2017-09-01 09:10:41 -07:00
libphonenumber-util.js Refactor number parsing and validation 2015-12-09 18:58:51 -08:00
libsignal-protocol-worker.js Update libsignal-protocol v1.0.0 2016-06-14 16:27:34 -07:00
libtextsecure.js Certificate pinning via node XMLHttpRequest implementation (#1394) 2017-09-14 17:03:17 -07:00
Mp3LameEncoder.min.js Add voice notes 2016-08-23 16:16:31 -07:00
notifications.js Remove remaining call to extension.notification.update 2017-09-14 16:53:45 -07:00
read_receipts.js Read/Delivery Receipts: Wait for resolution in main queue 2017-08-04 12:03:25 -07:00
registration.js Refactor registration event 2016-09-20 13:42:33 -07:00
reliable_trigger.js Apply reliable trigger to Backbone.Collection as well 2017-08-04 12:03:25 -07:00
rotate_signed_prekey_listener.js Reschedule all timers on time travel, set interval back to 1000ms 2017-09-14 16:53:53 -07:00
signal_protocol_store.js isUntrusted: Return false if firstUse is true 2017-08-04 12:03:25 -07:00
spell_check.js Merge locale-provided strings into english for failover support 2017-09-14 17:03:17 -07:00
storage.js Import: Wait until db writes resolve before saying we're done (#1401) 2017-09-14 17:03:17 -07:00
wall_clock_listener.js Reschedule all timers on time travel, set interval back to 1000ms 2017-09-14 16:53:53 -07:00
WebAudioRecorderMp3.js Add voice notes 2016-08-23 16:16:31 -07:00
XMLHttpRequest.js Certificate pinning via node XMLHttpRequest implementation (#1394) 2017-09-14 17:03:17 -07:00