YahooArchive / end-to-end

Use OpenPGP-based encryption in Yahoo mail.
http://yahoo.tumblr.com/post/113708033335/user-focused-security-end-to-end-encryption
Apache License 2.0
223 stars 40 forks source link

Merge upstream crypto changes #43

Closed daniel-ziegler closed 9 years ago

daniel-ziegler commented 9 years ago

Excludes changes to extension, except for a single cherry-picked commit (because a couple functions now use async rather than callbacks). Just about everything else is included.

yahoocla commented 9 years ago

CLA is valid!

diracdeltas commented 9 years ago

Great work. Extension built successfully from a fresh clone and seemed to work as expected when I installed in a browser profile. However, various unit tests (./do.sh testserver) are failing since they reference the old pgp context implementation:

Unit Test of e2e.ext.KeyserverClient [FAILED]
localhost:8000/src/javascript/crypto/e2e/extension/keyserver-client_test.html
4 of 4 tests run in 2019ms.
3 passed, 1 failed.
505 ms/test. 298 files loaded.
ERROR in testRefreshKeyring [testRefreshKeyring]
callback is not a function
> (unknown)
> anonymous at http://localhost:8000/javascript/crypto/e2e/extension/keyserver-client_test.js:287:5
> e2e.openpgp.ContextImpl.tryToImportKey_ at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:238:9
> null.<anonymous> at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:195:17
> Array.map
> Object.goog.array.map at http://localhost:8000/javascript/closure/array/array.js:307:46
> e2e.openpgp.ContextImpl.importKey at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:194:41
> populatePgpKeys at http://localhost:8000/javascript/crypto/e2e/extension/keyserver-client_test.js:286:7
> testRefreshKeyring at http://localhost:8000/javascript/crypto/e2e/extension/keyserver-client_test.js:264:19
> goog.testing.TestCase.Test.execute at http://localhost:8000/javascript/closure/testing/testcase.js:1296:12
> goog.testing.AsyncTestCase.doExecute_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:878:19
> goog.testing.AsyncTestCase.callTopOfStackFunc_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:756:10
> goog.testing.AsyncTestCase.pump_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:805:16

ERROR in testSendKey [testSendKey]
Expected <https://localhost:25519/v1/k/yan@mit.edu/T59IFsYRLW3GewSBBrwL> (String) but was <https://keyshop.paranoids.corp.yahoo.com:25519/v1/k/yan@mit.edu/T59IFsYRLW3GewSBBrwL> (String)
Difference was at position 8. Expected [...//localhost:2...] vs. actual [...//keyshop.paranoids.corp.yahoo.com:2...]
> _assert at http://localhost:8000/javascript/closure/testing/asynctestcase.js:634:26
> assertEquals at http://localhost:8000/javascript/closure/testing/asserts.js:376:32
> null.matchFn_ at http://localhost:8000/javascript/crypto/e2e/extension/keyserver-client_test.js:185:48
> goog.testing.mockmatchers.ArgumentMatcher.matches at http://localhost:8000/javascript/closure/testing/mockmatchers.js:81:25
> anonymous at http://localhost:8000/javascript/closure/testing/mockmatchers.js:378:11
> Object.goog.array.equals at http://localhost:8000/javascript/closure/array/array.js:1258:10
> goog.testing.mockmatchers.flexibleArrayMatcher at http://localhost:8000/javascript/closure/testing/mockmatchers.js:371:21
> goog.testing.Mock.$verifyCall at http://localhost:8000/javascript/closure/testing/mock.js:593:10
> goog.testing.StrictMock.$recordCall at http://localhost:8000/javascript/closure/testing/strictmock.js:72:16
> goog.testing.Mock.$mockMethod at http://localhost:8000/javascript/closure/testing/mock.js:344:19
> XMLHttpRequest.fn [as open] at http://localhost:8000/javascript/closure/testing/functionmock.js:49:27
> ext.keyserver.Client.sendPostRequest_ at http://localhost:8000/javascript/crypto/e2e/extension/keyserver-client.js:120:7
> ext.keyserver.Client.sendKey at http://localhost:8000/javascript/crypto/e2e/extension/keyserver-client.js:202:8
> testSendKey at http://localhost:8000/javascript/crypto/e2e/extension/keyserver-client_test.js:204:10
> goog.testing.TestCase.Test.execute at http://localhost:8000/javascript/closure/testing/testcase.js:1296:12
> goog.testing.AsyncTestCase.doExecute_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:878:19
> goog.testing.AsyncTestCase.callTopOfStackFunc_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:756:10
> goog.testing.AsyncTestCase.pump_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:805:16

Run individually »

Unit Test of e2e.ext.actions.ListAllUids [FAILED]
localhost:8000/src/javascript/crypto/e2e/extension/actions/listalluids_test.html
3 of 3 tests run in 782ms.
2 passed, 1 failed.
261 ms/test. 251 files loaded.
ERROR in testExecutePrivateKeys [Waiting for keys to be populated.]
callback is not a function
> (unknown)
> anonymous at http://localhost:8000/javascript/crypto/e2e/extension/actions/listalluids_test.js:197:5
> e2e.openpgp.ContextImpl.tryToImportKey_ at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:238:9
> null.&lt;anonymous&gt; at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:195:17
> Array.map
> Object.goog.array.map at http://localhost:8000/javascript/closure/array/array.js:307:46
> e2e.openpgp.ContextImpl.importKey at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:194:41
> testExecutePrivateKeys at http://localhost:8000/javascript/crypto/e2e/extension/actions/listalluids_test.js:196:14
> goog.testing.TestCase.Test.execute at http://localhost:8000/javascript/closure/testing/testcase.js:1296:12
> goog.testing.AsyncTestCase.doExecute_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:878:19
> goog.testing.AsyncTestCase.callTopOfStackFunc_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:756:10
> goog.testing.AsyncTestCase.pump_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:805:16
> goog.testing.AsyncTestCase.runTests at http://localhost:8000/javascript/closure/testing/asynctestcase.js:508:8
> goog.testing.TestRunner.execute at http://localhost:8000/javascript/closure/testing/testrunner.js:271:19

Run individually »

Unit Test of e2e.ext.ui.ComposeGlass [FAILED]
localhost:8000/src/javascript/crypto/e2e/extension/ui/glass/composeglass_test.html
8 of 8 tests run in 2661ms.
3 passed, 5 failed.
333 ms/test. 0 files loaded.
ERROR in testEncrypt [testEncrypt]
callback is not a function
> (unknown)
> anonymous at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:396:5
> e2e.openpgp.ContextImpl.tryToImportKey_ at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:238:9
> null.&lt;anonymous&gt; at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:195:17
> Array.map
> Object.goog.array.map at http://localhost:8000/javascript/closure/array/array.js:307:46
> e2e.openpgp.ContextImpl.importKey at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:194:41
> populatePgpKeys at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:395:7
> testEncrypt at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:262:19
> goog.testing.TestCase.Test.execute at http://localhost:8000/javascript/closure/testing/testcase.js:1296:12
> goog.testing.AsyncTestCase.doExecute_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:878:19
> goog.testing.AsyncTestCase.callTopOfStackFunc_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:756:10
> goog.testing.AsyncTestCase.pump_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:805:16
> goog.testing.AsyncTestCase.runTests at http://localhost:8000/javascript/closure/testing/asynctestcase.js:508:8
> goog.testing.TestRunner.execute at http://localhost:8000/javascript/closure/testing/testrunner.js:271:19

ERROR in testRender [testRender]
callback is not a function
> (unknown)
> anonymous at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:396:5
> e2e.openpgp.ContextImpl.tryToImportKey_ at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:238:9
> null.&lt;anonymous&gt; at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:195:17
> Array.map
> Object.goog.array.map at http://localhost:8000/javascript/closure/array/array.js:307:46
> e2e.openpgp.ContextImpl.importKey at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:194:41
> populatePgpKeys at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:395:7
> testRender at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:197:19
> goog.testing.TestCase.Test.execute at http://localhost:8000/javascript/closure/testing/testcase.js:1296:12
> goog.testing.AsyncTestCase.doExecute_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:878:19
> goog.testing.AsyncTestCase.callTopOfStackFunc_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:756:10
> goog.testing.AsyncTestCase.pump_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:805:16

ERROR in testRenderAndImportKey [testRenderAndImportKey]
callback is not a function
> (unknown)
> anonymous at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:396:5
> e2e.openpgp.ContextImpl.tryToImportKey_ at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:238:9
> null.&lt;anonymous&gt; at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:195:17
> Array.map
> Object.goog.array.map at http://localhost:8000/javascript/closure/array/array.js:307:46
> e2e.openpgp.ContextImpl.importKey at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:194:41
> populatePgpKeys at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:395:7
> testRenderAndImportKey at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:242:3
> goog.testing.TestCase.Test.execute at http://localhost:8000/javascript/closure/testing/testcase.js:1296:12
> goog.testing.AsyncTestCase.doExecute_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:878:19
> goog.testing.AsyncTestCase.callTopOfStackFunc_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:756:10
> goog.testing.AsyncTestCase.pump_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:805:16

ERROR in testRenderWithMissingRecipient [testRenderWithMissingRecipient]
callback is not a function
> (unknown)
> anonymous at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:396:5
> e2e.openpgp.ContextImpl.tryToImportKey_ at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:238:9
> null.&lt;anonymous&gt; at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:195:17
> Array.map
> Object.goog.array.map at http://localhost:8000/javascript/closure/array/array.js:307:46
> e2e.openpgp.ContextImpl.importKey at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:194:41
> populatePgpKeys at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:395:7
> testRenderWithMissingRecipient at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:213:3
> goog.testing.TestCase.Test.execute at http://localhost:8000/javascript/closure/testing/testcase.js:1296:12
> goog.testing.AsyncTestCase.doExecute_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:878:19
> goog.testing.AsyncTestCase.callTopOfStackFunc_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:756:10
> goog.testing.AsyncTestCase.pump_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:805:16

ERROR in testSendSignedPlaintext [testSendSignedPlaintext]
callback is not a function
> (unknown)
> anonymous at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:396:5
> e2e.openpgp.ContextImpl.tryToImportKey_ at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:238:9
> null.&lt;anonymous&gt; at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:195:17
> Array.map
> Object.goog.array.map at http://localhost:8000/javascript/closure/array/array.js:307:46
> e2e.openpgp.ContextImpl.importKey at http://localhost:8000/javascript/crypto/e2e/openpgp/contextimpl.js:194:41
> populatePgpKeys at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:395:7
> testSendSignedPlaintext at http://localhost:8000/javascript/crypto/e2e/extension/ui/glass/composeglass_test.js:330:3
> goog.testing.TestCase.Test.execute at http://localhost:8000/javascript/closure/testing/testcase.js:1296:12
> goog.testing.AsyncTestCase.doExecute_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:878:19
> goog.testing.AsyncTestCase.callTopOfStackFunc_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:756:10
> goog.testing.AsyncTestCase.pump_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:805:16

Run individually »

Integration tests for e2e.otr/ [FAILED]
localhost:8000/src/javascript/crypto/e2e/otr/integration_test.html
2 of 2 tests run in 1739ms.
0 passed, 2 failed.
870 ms/test. 100 files loaded.
ERROR in testAKE
Cannot read property 'sign' of null
> (unknown)
> new e2e.otr.Sig at http://localhost:8000/javascript/crypto/e2e/otr/sig.js:48:60
> e2e.otr.message.RevealSignature.serializeMessageContent at http://localhost:8000/javascript/crypto/e2e/otr/message/revealsignature.js:94:5
> e2e.otr.message.Encoded.serialize at http://localhost:8000/javascript/crypto/e2e/otr/message/encoded.js:127:30
> e2e.otr.message.Encoded.toString at http://localhost:8000/javascript/crypto/e2e/otr/message/encoded.js:134:46
> e2e.otr.message.Message.prepareSend at http://localhost:8000/javascript/crypto/e2e/otr/message/message.js:50:15
> Object.goog.base at http://localhost:8000/javascript/closure/base.js:2252:45
> e2e.otr.message.Encoded.prepareSend at http://localhost:8000/javascript/crypto/e2e/otr/message/encoded.js:82:15
> Object.goog.base at http://localhost:8000/javascript/closure/base.js:2252:45
> e2e.otr.message.RevealSignature.prepareSend at http://localhost:8000/javascript/crypto/e2e/otr/message/revealsignature.js:72:15
> null.send at http://localhost:8000/src/javascript/crypto/e2e/otr/integration_test.html:46:17
> Object.e2e.otr.message.DhKey.process at http://localhost:8000/javascript/crypto/e2e/otr/message/dhkey.js:99:15
> Object.e2e.otr.message.handler.process at http://localhost:8000/javascript/crypto/e2e/otr/message/handler.js:92:42
> Object.e2e.otr.message.handler.parse at http://localhost:8000/javascript/crypto/e2e/otr/message/handler.js:63:31
> e2e.otr.Session.processMessage at http://localhost:8000/javascript/crypto/e2e/otr/session.js:79:27
> testAKE at http://localhost:8000/src/javascript/crypto/e2e/otr/integration_test.html:148:16
> goog.testing.TestCase.invokeTestFunction_ at http://localhost:8000/javascript/closure/testing/testcase.js:762:21
> goog.testing.TestCase.safeRunTest_ at http://localhost:8000/javascript/closure/testing/testcase.js:715:8
> goog.testing.TestCase.invokeTestFunction_ at http://localhost:8000/javascript/closure/testing/testcase.js:776:17
> goog.testing.TestCase.runNextTest_ at http://localhost:8000/javascript/closure/testing/testcase.js:705:8
> null.&lt;anonymous&gt; at http://localhost:8000/javascript/closure/testing/testcase.js:671:10
> new goog.Promise at http://localhost:8000/javascript/closure/promise/promise.js:166:16
> goog.testing.TestCase.runTestsReturningPromise at http://localhost:8000/javascript/closure/testing/testcase.js:669:10
> goog.testing.TestRunner.execute at http://localhost:8000/javascript/closure/testing/testrunner.js:269:19

ERROR in testDataMessage
Not yet implemented.
> (unknown)
> Object.goog.base at http://localhost:8000/javascript/closure/base.js:2237:43
> e2e.otr.error.Error at http://localhost:8000/javascript/crypto/e2e/otr/error.js:41:8
> Object.goog.base at http://localhost:8000/javascript/closure/base.js:2237:43
> new e2e.otr.error.NotImplementedError at http://localhost:8000/javascript/crypto/e2e/otr/error.js:67:8
> Object.e2e.otr.message.Data.process at http://localhost:8000/javascript/crypto/e2e/otr/message/data.js:214:13
> Object.e2e.otr.message.handler.process at http://localhost:8000/javascript/crypto/e2e/otr/message/handler.js:92:42
> Object.e2e.otr.message.handler.parse at http://localhost:8000/javascript/crypto/e2e/otr/message/handler.js:63:31
> e2e.otr.Session.processMessage at http://localhost:8000/javascript/crypto/e2e/otr/session.js:79:27
> testDataMessage at http://localhost:8000/src/javascript/crypto/e2e/otr/integration_test.html:183:17
> goog.testing.TestCase.invokeTestFunction_ at http://localhost:8000/javascript/closure/testing/testcase.js:762:21
> goog.testing.TestCase.safeRunTest_ at http://localhost:8000/javascript/closure/testing/testcase.js:715:8
> goog.testing.TestCase.invokeTestFunction_ at http://localhost:8000/javascript/closure/testing/testcase.js:776:17
> goog.testing.TestCase.runNextTest_ at http://localhost:8000/javascript/closure/testing/testcase.js:705:8

Run individually »
daniel-ziegler commented 9 years ago

I believe all relevant tests are passing now. Some are a bit flaky, and two otr tests don't work at all, but I think it's the same upstream, so something is just not implemented.

diracdeltas commented 9 years ago

I still get one non-spurious test failure:

localhost:8000/src/javascript/crypto/e2e/extension/ui/setup/setup_test.html
12 of 12 tests run in 647ms.
12 passed, 0 failed.
54 ms/test. 0 files loaded.
.
11:23:29.716  Start
11:23:29.748  testCancelRestore : PASSED (run individually)
11:23:29.759  testGenerateBadKey : PASSED (run individually)
11:23:30.115  Breaking async
11:23:30.137  testGenerateKey : PASSED (run individually)
11:23:30.271  testImportKeyring : PASSED (run individually)
11:23:30.281  testIntroDefault : PASSED (run individually)
11:23:30.289  testIntroRestore : PASSED (run individually)
11:23:30.296  testRender : PASSED (run individually)
11:23:30.311  ERROR in null
Missing a call to callback
Expected: 1 but was: 0
> (unknown)
> (unknown)
> goog.testing.Mock.$throwException at http://localhost:8000/javascript/closure/testing/mock.js:535:24
> goog.testing.StrictMock.$verify at http://localhost:8000/javascript/closure/testing/strictmock.js:119:12
> anonymous at http://localhost:8000/javascript/closure/testing/mockcontrol.js:91:7
> Array.forEach
> Object.goog.array.forEach at http://localhost:8000/javascript/closure/array/array.js:203:43
> goog.testing.MockControl.$verifyAll at http://localhost:8000/javascript/closure/testing/mockcontrol.js:90:14
> testRenderPassphraseCallback at http://localhost:8000/javascript/crypto/e2e/extension/ui/setup/setup_test.js:331:15
> goog.testing.TestCase.Test.execute at http://localhost:8000/javascript/closure/testing/testcase.js:1296:12
> goog.testing.AsyncTestCase.doExecute_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:878:19
> goog.testing.AsyncTestCase.callTopOfStackFunc_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:756:10
> goog.testing.AsyncTestCase.pump_ at http://localhost:8000/javascript/closure/testing/asynctestcase.js:805:16
11:23:30.311  testRenderPassphraseCallback [testRenderPassphraseCallback] : FAILED (run individually)
11:23:30.321  testRenderPassphraseCallback : PASSED (run individually)
11:23:30.337  testRestoreKey : PASSED (run individually)
11:23:30.348  testShowBackup : PASSED (run individually)
11:23:30.355  testShowPassphraseTutorial : PASSED (run individually)
11:23:30.363  testUpdateKeyringPassphrase : PASSED (run individually)
11:23:30.363  Done
diracdeltas commented 9 years ago

LGTM once the setup test is fixed. Please open this against master as well, minus ce72540 :).

You should probably add yourself and your preferred email to the CONTRIBUTORS file.