summaryrefslogtreecommitdiff
path: root/client/src/leap
AgeCommit message (Collapse)Author
2015-08-26[refactor] simplify send_docs operationsVictor Shyba
Just extracted some common logic to create u1db formatted requests into RequestBody class and created new methods to represent operations done during send_docs. This also removes send_one_doc, but does not add batching yet. The single send behavior still the same, represented by the parameter passed into RequestBody 'remove' method.
2015-08-26[refactor] simplify entity and content typeVictor Shyba
_prepare was being used to concatenate and prepare request body to send or receive data on the format expected by the server. This behavior wasnt clear, so I added a new class to abstract this out. Content type and auth headers was being copied around methods. Now the request method accepts a content_type parameter to remove this duplication.
2015-08-26[refactor] extract logging and emitting on targetVictor Shyba
Creating a message, emitting an event and logging afterwards is a single operation outside of of those method's responsabilities.
2015-08-24[refactor] remove simplejson dep on clientdrebs
2015-08-20[bug] always emit end-of-sync eventdrebs
2015-08-20[bug] update target metadata after first receivedrebs
After we receive one document from the target database, we have to update the target metadata or else we will not be able to succesfully return the new generation and transaction id of the target when receiving exactly one document during a sync.
2015-08-20[bug] return tuple in get_sync_infodrebs
Tests actually expect a tuple instead of a list on the return value of get_sync_info().
2015-08-19[style] pep8 cleanupsKali Kaneko
2015-08-19[bug] wait for db init on sync decrypter pooldrebs
Previous to this modification, the initialization of the sync decrypter pool could happen concurrently with other database operations. That could cause the pool to hang because it could be waiting for something that was mistakenly deleted because of the wrong order of database operations. This commit implements a standard which we already use in leap.keymanager and leap.mail which makes some methods wait for the initialization operation before they are actually called. Closes: #7386
2015-08-19[refactor] remove threadpool from sqlcipher backenddrebs
The old strategy for having Soledad sync running asynchronously with other API calls was to have the sync running in its own threadpool. This is not needed now that all sync code uses deferreds and will not block. This commit removes what's left from the old threadpool.
2015-08-19[bug] hold sync lock while running post-sync hooksdrebs
Previous to this modification, the post-sync hooks were run after the sync lock was released. In that scenario, the next sync process could start before the previous sync's post-sync hooks were run. In general, we want the hooks to run while the current sync lock is still locked, even though for some plugins this might not make a difference.
2015-08-18[refactor] rename sync lock and improve docstringsdrebs
2015-08-18[refactor] clarify sync target closingdrebs
2015-08-17[style] pep8 cleanupKali Kaneko
2015-08-12[bug] wrong sqlcipher passphrase now raises correctlyBruno Wagner
When you tried to start a local sqlcipher that was created before, with the wrong passphrase, the code was raising a sqlcipher DatabaseError, there were tests covering this but they were expecting a WrongMacError that was never raised. I added code to wrap the DatabaseError and raise a new exception DatabaseAccessError that is specific to soledad and adapted the tests to expect it
2015-08-12[bug] changes multiprocessing.Queue to Twisted'sVictor Shyba
multiprocessing.Queue is suitable for process communication, but its not the ideal for a reactor model. This commit changes it to DeferredQueue, where consumers and producers doesnt block and Twisted can handle them better.
2015-08-12[bug] raise u1db errors based on http responsedrebs
When we started to use the twisted http agent, we forgot to intercept http response and raise the appropriate u1db errors based on the response status code and messages. This commit implements that by redefining the http body reader used by the http agent.
2015-08-12[bug] Encdecpool won't explode if stopped twiceBruno Wagner
The encryption pool could be stopped twice and would break on the second attempt because it deletes the encryption queue variable. Added a condition to make sure it only deletes the encryption queue if it exists, making it more idempotent
2015-08-12[bug] Sync Locking based on class + db file pathVictor Shyba
Change locking to be class based and each lock generated by db file path.
2015-08-12[bug] fixes concurrent sync and their testsVictor Shyba
Changes threading.lock to DeferredLock and checks syncing attribute by looking into the lock state. Also, applies more of startTwistedServer on tests that relies on HTTP/1.1. Fixes mock for events
2015-08-12[bug] close http_target when soledad closesVictor Shyba
Soledad has a close method that wasn't calling http_target close. The reference to sync exchange was being deleted without proper closing of underlying resources.
2015-08-11[feat] emit a dict instead of a strIvan Alejandro
2015-08-05[tests] Fixed remaining parse testsBruno Wagner
All the response parse tests are passing now, response with no entries was broken because it wasn't being treated and the others were broken because of calls that no longer existed
2015-08-05[tests] Created a setup for the http target testsBruno Wagner
Created a setup for the http target tests Fixed two tests relying on http target that were outdated Fixed a call for an exception that doesn't exist, it won't break anymore if it gets to that exception
2015-08-05[style] Fixed PEP8 warningBruno Wagner
Line break before binary operator breaks PEP8, fixed that in the client api.py
2015-08-04[bug] Soledad._crypto has to be initialized earlierKali Kaneko
before sqlcipher backend, or the attribute is not found. this is a leftover of the recent refactor
2015-08-04[style] pep8 cleanupKali Kaneko
2015-08-04[test] add test for many documents decryptiondrebs
2015-08-04[feat] add running state method to enc/dec poolsdrebs
2015-08-04[refactor] remove circular dependency in SoledadCryptoRuben Pollan
SoledadCrypto had Soledad as parameter to be able to use SoledadSecrets. SoledadSecrets had SoledadCrypto as parameter to use *crypt_sym. This commit removes this circular dependency passing directly the secret that SoledadCrypto cares about to the constructor and removing the *crypt_sym methods from SoledadCrypto. - Resolves: #7338
2015-08-04[refactor] standardize start/stop of enc/dec poolsdrebs
* change close method name to stop * add start/stop methods to both enc/dec clases * remove any delayed calls on pool shutdown
2015-08-04[bug] add log msg to sent docs on syncdrebs
2015-07-29[style] Fixed pep8 warning on api.pyBruno Wagner
The bolean operator must come before a line break, not after according to pep8
2015-07-27[bug] avoid double decryption of documentsdrebs
Because of how the incoming document queue is implemented, it could be the case that a document was sent to async decryption queue more than once. This commit creates a list of documents to be decrypted, so we avoid sending the same document to the queue more than once.
2015-07-27[feat] add log message for document encryptiondrebs
2015-07-27[bug] fix order of incoming document eventsdrebs
The incoming documents events are meant to be used by a progress bar for soledad sync, yet to be implemented. When deferred decryption was used, the events were sent out of order, depending on the order of arrival of the documents. This commit changes it so that the content of the emited events are in order, so it is meaningful for the implementation of a progress bar. Note that even after documents are received from the server, they will still be decrypted asynchronously, so another signal could be implemented to signal for the waiting of the decryption of incoming documents.
2015-07-27[bug] remove mac from secrets filedrebs
This is how a secret was stored in the secrets json file: * each secret is symmetrically encrypted amd MACed with keys derived from the user's passphrase. * the encrypted secrets dictionary is then MACed with another key derived * from the user's passphrase. * each key is derived using scrypt and a unique random salt. There are disadvantages to this approach: * repeating scrypt many times is a waste of time. * an attacker could crack whichever has weaker parameters, if they get out of sync. * if an attacker can modify the secret in a way it is good to decrypt the database, then she can also modify the MAC. The solution for this is: * completelly eliminate the MAC from the storage secrets file. * attempt to decrypt the database with whatever is got from the decryption of the secret. If that is wrong, report an error. Closes #6980.
2015-07-26[bug] fix syntax errorKali Kaneko
resulting from the previous pep8 cleanup
2015-07-24[style] fixed typo in custom docid fileBruno Wagner
2015-07-24[style] fixed do not assign a lambda in soledad clientBruno Wagner
2015-07-24[style] fixed soledad client pep8 warningsBruno Wagner
2015-07-23[style] pep8 cleanupKali Kaneko
to make all CIs happy :)
2015-07-23[bug] move sync db and encpool creation to apidrebs
Deferred encryption was disabled because the soledad u1db wrapper for adbapi did not correctly udated the parameter that controls it. Also, it did not contain the encrypter pool. This commit moves the sync db and encrypt pool to the main api, so they can be passed to the wrapper and deferred encryption can work.
2015-07-22[refactor] use a deferred to signal when SyncDecriptionPool has finishedRuben Pollan
It makes the code simpler and clearer to use a deferred instead of having to pull on 'has_finished'. - Related: #7234
2015-06-30[feature] add close() method to client http targetdrebs
HTTP client cached connections will hang around in the reactor if they are not properly cleaned up, and might raise a "reactor unclean" message on shutdown. This commit adds a close() method to the client http target that will cleanup those connections.
2015-06-15[style] minor style fixes for correctionKali Kaneko
after suggestions in the review
2015-06-15[refactor] use twisted logging facility to log failureKali Kaneko
2015-06-15[refactor] move collect_plugins to leap.commonKali Kaneko
2015-06-15[feature] filter documents before passing them to the pluginKali Kaneko
2015-06-15[feature] use raw operation, returns no resultKali Kaneko