Giter Club home page Giter Club logo

mylar's Introduction

Mylar - ported to Meteor v1.1

![Gitter](https://badges.gitter.im/Join Chat.svg)

About

Web applications rely on servers to store and process confidential information. However, anyone who gains access to the server (e.g., an attacker, a curious administrator, or a government) can obtain all of the data stored there.

Mylar protects data confidentiality even when an attacker gets full access to servers. Mylar stores only encrypted data on the server, and decrypts data only in users' browsers.

Simply encrypting each user's data with a user key does not suffice, and Mylar addresses three challenges in making this approach work.

  • First, Mylar allows users to share keys and data securely in the presence of an active adversary (man in the middle attack or a malicious administrator actively tampering with the data sent to the client)
  • Second, Mylar allows the server to perform keyword search over encrypted documents
  • Finally, Mylar ensures that client-side application code is authentic, even if the server is malicious.

Check it out

Just start and examine the example chat

    cd example_EncChat/
    meteor

    // => App running at: http://localhost:3000/

Create a new User, then create a new room. Hack in a message. Send.

If you now take a look at the local Meteor-MongoDb (with a gui like Robomongo or the meteor mongo-shell, you will see a field named "message_enc" that contains the encryption of the message. There should be no field "message", which before contained the unencrypted data and will only appear on the client when the message is successfully decrypted.

Use it

First, read the MIT Mylar paper in /docs/MIT_Mylar.pdf and make sure you understand the section "Building a Mylar application".

Mylar is directly hooking into core packages like DDP, Mongo and the Accounts system to intercept the data stream for truly transparent encryption. So we can not simply provide Mylar as an Meteor package (right now) - we have to override core packages!

Luckily this is easy with the new package system.

    // copy or symlink everything in /packages to
    // your meteor project's packages folder

    // copy
    cp -R packages/* /your/project/packages/

    // symlink - go into your projects package dir, then do this:
    // of course replace "../../packages" with a path to the mylar package dir
     find ../../packages -type d -mindepth 0 -maxdepth 1 -exec ln -s '{}' . \;

Look at the /example_EncChat for how to get started with collection declarations.

example_EncChat/model.js (client & server)

    //
    Messages._encrypted_fields({
        'message': {
            princ: 'roomprinc',
            princtype: 'room',
            auth: ['_id']
        }
    });
    Messages._immutable({roomprinc: ['rID', 'roomTitle', '_id']});


important for the IDP, we need to publish explicitly the _wrapped_pk fields of the user doc (for now)

    Meteor.startup(function () {
        // pub
        if (Meteor.isServer) {
            Meteor.publish("users", function () {
                return Meteor.users.find(this.userId, {fields: {}});
            });
        }
        // sub
        if (Meteor.isClient) {
            Tracker.autorun(function () {
                Meteor.subscribe("users");
            })
        }
    })

Then go to /docs and also check out /enc_modules for (partially outdated) implementation details.

Contribution Info

I marked all mylar-related modifications to the core packages ddp and mongo with MYLAR START/END comments for easier merging. Can we wrap this into a single package overriding the core packages by any chance?

Enable search & building the enc_server

You'll need the following libraries to build Mylar:

  • libreadline
  • libgmp
  • libpbc
  • libcrypto++9

Open a browser and visit localhost:3000 or from a different machine than the server, visit http://:3000. Have fun with the application!

The app is secured against passive adversaries (adversaries who read all data at the server, but do not actively change information).

To enable search, you need two things:

  1. Install the search plugin In order to use the search plugin, you'll need to build it for your system using the FireBreath framework for Firefox. You should navigate to enc_modules/crypto_fire and follow the README there in order to set it up. In addition, there is a binary that works on some systems in the enc_modules/crypto_fire/Binaries/ folder, which you should copy to: $(HOME)/.mozilla/plugins/, creating the plugins folder if necessary.

  2. add the search package to the application meteor add search

mylar's People

Contributors

arbesfeld avatar avital avatar awwx avatar benjamn avatar clarete avatar cmather avatar dandv avatar debergalis avatar dgreensp avatar ed-von-schleck avatar estark37 avatar glasser avatar gschmidt avatar html5cat avatar jonathankingston avatar justinsb avatar marcandre avatar mariapacana avatar meonkeys avatar mitar avatar mizzao avatar mquandalle avatar n1mmy avatar possibilities avatar slava avatar strikeout avatar timhaines avatar tmeasday avatar zealoushacker avatar zol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mylar's Issues

b64.js file missing

Hello,

While trying to add the search functionality, following your readme (that's also the default readme on the github root page), you instruct us to:

<===================================================
"add the search package to the application meteor add search"
<===================================================

On executing the above command, the following error is reported:
<===================================================
=> Errors while adding packages:

While building package search:
error: File not found: b64.js
<===================================================

The absence of b64.js can be further verified by:
1> grep-ing through the code
2> searching for b64.js via the github repository search feature in the site.

Please add the missing file.

Best!

Unkonwn package in top-level depenencies

I got the following error when tried to run' example_EncChat'.

any help please

=> Started MongoDB.
=> Errors prevented startup:

While selecting package versions:
error: unknown package in top-level dependencies: accounts-idp
unknown package in top-level dependencies: principal

=> Your application has errors. Waiting for file change.

c:\Meteor\mylar-master\example_EncChat>meteor update
Update to release [email protected] is impossible:
While selecting package versions:
error: unknown package in top-level dependencies: accounts-idp
unknown package in top-level dependencies: principal

This project is at the latest release which is compatible with your current package constraints.
=> Errors while upgrading packages:

While selecting package versions:
error: unknown package in top-level dependencies: accounts-idp
unknown package in top-level dependencies: principal

Meteor 1.1 (and later)

I see that the latest merges with the core packages were for Meteor 1.0. Do you intend to provide support for Meteor 1.1 (and the upcoming 1.2) versions?

tools/main.js missing

When running meteor from any location I get the following error:
$ ../meteor
Building enc_modules/crypto_mk
perl mergedep.pl obj/.deps obj/util/util.d obj/main/ec.d obj/main/multikey_sum.d obj/main/b64_wrapper.d obj/main/multikey.d obj/main/base64.d obj/main/prng.d obj/test/test.d
make: Nothing to be done for all'. Building enc_modules/crypto_server make: Nothing to be done forall'.
2926
Crypto server already running

module.js:340
throw err;
^
Error: Cannot find module '/home/idbill/Workspace/mylar/tools/main.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

Note that the tools directory that is specified above does not exist.

If I do a 'find' for main.js, it shows up in:
./enc_modules/idp-pw/client/main.js
./packages/cprogress/lib/main.js
./dev_bundle/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/* (67 matches)

error on search

when I search with keywords in chat room messages. sometimes I get the following error.

minimongo.js:53 Uncaught Error: Mod on id not allowed
at MinimongoError (minimongo.js:53)
at modify.js:49
at Function.
.each..forEach (underscore.js:113)
at modify.js:43
at Function.
.each._.forEach (underscore.js:113)
at Function.LocalCollection._modify (modify.js:36)
at LocalCollection._modifyAndNotify (minimongo.js:799)
at minimongo.js:717
at LocalCollection._eachPossiblyMatchingDoc (minimongo.js:604)
at LocalCollection.update (minimongo.js:712)
so,what is going on? ...thx

Write Tests!

write unit-tests to make the encryption process bulletproof

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.