crypto-pouch icon indicating copy to clipboard operation
crypto-pouch copied to clipboard

Using a view filter during a replication doesn't work

Open mikeymckay opened this issue 8 years ago • 6 comments

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.

mikeymckay avatar Jun 23 '16 12:06 mikeymckay

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 ?

calvinmetcalf avatar Jun 23 '16 12:06 calvinmetcalf

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…}

mikeymckay avatar Jun 23 '16 12:06 mikeymckay

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

calvinmetcalf avatar Jun 23 '16 15:06 calvinmetcalf

I've tried replicating to both local and to an external couch with the same result. On Jun 23, 2016 18:41, "Calvin Metcalf" [email protected] 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 .

mikeymckay avatar Jun 23 '16 17:06 mikeymckay

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.

rjcorwin avatar Jan 22 '20 17:01 rjcorwin

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 :)

garbados avatar Aug 06 '21 23:08 garbados