multiparty / web-mpc

Platform for deploying web-based privacy-preserving data surveys using secure multi-party computation (MPC).
https://www.multiparty.org
MIT License
54 stars 22 forks source link

Jiff integration #102

Closed KinanBab closed 5 years ago

KinanBab commented 5 years ago

Integrate JIFF into Web-MPC.

I can squash the commits down if you do not want to cluter the commit history much. Also, I do not know if this should go to master or pacesetters, but I branched of pacesetters, and I have all of Lucy's changes from it.

CHANGES

Server (almost) completely rewritten and re-organized, mainly made out of :

  1. server/app: contains all the routes, joi validations, and routes authentication
  2. server/jiff: all the jiff stuff (setting up the jiff server, and the server side MPC code, and hooks)
  3. server/modules: mongoose modules, and wrappers around them for quick insert/update/query etc
  4. server/routes.js and server/statics.js: contain route definitions (mapping a url to a function, authentication function, and joi schema)
  5. server/production.js: for managing whether to use http or https, and redirecting http to https etc

The functionality is the same as before, with two exceptions:

  1. There was a bug in displaying the submission history, where if a party submits then resubmits, it appears twice for analysts that are monitoring during that time, but then if an analyst starts monitoring afterwards, only the most recent one appears. I was afraid this may leak the identity of the submitters. This has been fixed, you see all the submissions including resubmissions always.
  2. Before, the server would aggregate and send (basically perform the server side computation) each time the analyst unmasks. Instead, now the server executes its portion of the MPC computation as soon as the analyst stops the session. I do not know if this is desirable, but it speeds things up a lot, and also allows for added reliability (in cases where the server is shutdown).

Client I basically added a JIFF controller and re-wrote app/helper/mpc.js to use JIFF. I also moved out everything related to generating keys, parsing PEMs, dumping PEMs, encryption and decryption, etc to a specific file app/helper/pki.js, I use that file in the JIFFController for hooks, but also in when a session is created to generate public keys.

Survey questions I tested everything with and without questions, everything works as expected. If you have questions, they wont be rendered in the browser in unmask.html, but they will downloaded as a csv file (this is the same as before).

Different deployment configurations under server/config there is a pacesetters.json configuration file. It contains server configurations (approved domains, and fredrick's email for the https certificate) and client configurations (for now I added the path to the data table template, the title, subtitle, and logo that are display in index.html). The server injects the configuration into index.html as it serves it using an express rendering plugin. I only had time to do the title/subtitle/log as a proof-of-concept, but we can use this to easily customize the UI for each deployment (displaying different text, changing images, and even the layout) while easily managing switching between them instead of using git branches. You can specify the configuration file name (without the path or .json) as an environment variable called WEBMPC_DEPLOYMENT. all this is in the readme.md file.

Fix Last thing, I fixed the multiple package.json issue, we only have one at the root directory, and all you need to do is run npm install once there.

lucyq commented 5 years ago

I changed the base to pacesetters. After this is merged, I'm going to merge the web analytics code and then we can merge to master.

lucyq commented 5 years ago

To get JIFF: git submodule init git submodule update

lucyq commented 5 years ago

must also do: cd jiff npm install

lucyq commented 5 years ago

Error upon entering in valid session key & session password in index page.

screen shot 2019-01-24 at 4 48 19 pm
lucyq commented 5 years ago

Done w/ my code review.