calvinmetcalf / crypto-pouch

plugin for encrypted pouchdb/couchdb databases
MIT License
243 stars 44 forks source link

Using a view filter during a replication doesn't work #37

Open mikeymckay opened 8 years ago

mikeymckay commented 8 years ago

If I try and do a replication from a pouchdb with crypto-pouch applied it works fine. But when I then use the option: {filter:"_view",view:"results"} // results is a view no documents are transferred. If I replicate the encrypted db to an unencrypted db, and then do the same replication from the unencrypted db it works fine.

calvinmetcalf commented 8 years ago

so there is likely 1 of 2 issues here either

  1. transform-pouch isn't passing the docs through decrypt before they go to the filter function
  2. transform-pouch or us isn't decrypting the design doc before we try to filter it

can you try again but passing a function to the filter instead of a design doc ?

mikeymckay commented 8 years ago

If I pass in a filter function it works fine:

p.replicate.to(t,{filter: function(doc){return doc.collection === 'result'}}).catch(function(error){console.log(error)}).then(function(res){console.log(res)})

-> Object {ok: true, start_time: Thu Jun 23 2016 15:47:49 GMT+0300 (EAT), docs_read: 2, docs_written: 2, doc_write_failures: 0…}

calvinmetcalf commented 8 years ago

are either of the dbs http dbs or are they all local ones ?

mikeymckay commented 8 years ago

I've tried replicating to both local and to an external couch with the same result. On Jun 23, 2016 18:41, "Calvin Metcalf" notifications@github.com wrote:

are either of the dbs http dbs or are they all local ones ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/calvinmetcalf/crypto-pouch/issues/37#issuecomment-228091769, or mute the thread https://github.com/notifications/unsubscribe/AAAu74ev844Z3PILU99sWOOC1QZf6X4sks5qOqkPgaJpZM4I8vsH .

rjcorwin commented 4 years ago

I'm seeing this issue also when using Mango queries to filter replication. A work around that might work for some projects is to create a temporary database without crypto enabled, doing a full replication to that, doing the filtered replication between the temporary database and the target database, then destroying the temporary database. However even after the temporary database is destroyed, an attacker might be able to recover it.

garbados commented 3 years ago

Hi folks! We just published version 4.0 which includes a significant refactor and many different dependencies. Could you try this again and let me know how it goes? I can help you debug from there :)