Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 74309 invoked from network); 28 Oct 2010 15:44:24 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 28 Oct 2010 15:44:24 -0000 Received: (qmail 66256 invoked by uid 500); 28 Oct 2010 15:44:24 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 66105 invoked by uid 500); 28 Oct 2010 15:44:21 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 66097 invoked by uid 99); 28 Oct 2010 15:44:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Oct 2010 15:44:20 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of samuelgoto@gmail.com designates 209.85.216.180 as permitted sender) Received: from [209.85.216.180] (HELO mail-qy0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Oct 2010 15:44:16 +0000 Received: by qyk8 with SMTP id 8so2120884qyk.11 for ; Thu, 28 Oct 2010 08:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=omcE/lY7aFhPv5hpByOUBWj7yAqgPVdlX87+DYMPxS4=; b=ZRP0DHrPZbN+OzCyiT+l47yXIu2mQmG1Xx3Xu/Dbr0DjVWoeRPQjnWYKidYhxv3UEl BPEWM0Ym3sTq4io4XueXY9od3chrXVTjwibEKxCLk6WyKSf8FQ8yH7E12ihpu3EbmkQt rVK7y0wkHz6C+n75bI/B2jrWe8GitvPEJYEeY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=kzsZnpmIoiCR+gi/fHORWWQeA+GhwWbVbF39steCQ60dutVe9686xGD6bLPFalJxlq FP98bLdFCT58r1GFTyTAQounOzQVxavuxAgiGFzbYZ3QUZQJScD0ngwmMlaxSZ4VRI7/ r8cKheID60pI5U7uylZC+cFeEy8ktv7iAk1Es= MIME-Version: 1.0 Received: by 10.224.203.132 with SMTP id fi4mr4254329qab.120.1288280634040; Thu, 28 Oct 2010 08:43:54 -0700 (PDT) Received: by 10.229.78.223 with HTTP; Thu, 28 Oct 2010 08:43:53 -0700 (PDT) In-Reply-To: <750A58D2-3F68-4865-8A37-9C36EB5C27C0@apache.org> References: <4CC6F637.3010007@couchone.com> <0A04DCBD-8CC5-488A-873E-2FCE52069377@googlemail.com> <750A58D2-3F68-4865-8A37-9C36EB5C27C0@apache.org> Date: Thu, 28 Oct 2010 08:43:53 -0700 Message-ID: Subject: Re: Introducing Bram Neijt From: sgoto To: dev@couchdb.apache.org Content-Type: multipart/alternative; boundary=20cf3005129290237c0493af352b --20cf3005129290237c0493af352b Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable argh sorry, wrong link :) i hope this one works now :) https://docs.google.com/document/pub?id=3D1NWZ9xhsQvUL24IDa4erYcEZwkoNH6m13= fizn8_og0gY On Thu, Oct 28, 2010 at 7:29 AM, Jan Lehnardt wrote: > > On 28 Oct 2010, at 14:38, Sebastian Cohnen wrote: > > > nice example, the document is not public ;) > > haha, I thought that was the joke :D > > Cheers > Jan > -- > > > > > On 27.10.2010, at 18:08, sgoto wrote: > > > >> i've put together a document on how i am handling per document > authorization > >> for my couchdb projects. it might be useful. > >> > >> > https://docs.google.com/document/edit?id=3D1NWZ9xhsQvUL24IDa4erYcEZwkoNH6= m13fizn8_og0gY&hl=3Den&pli=3D1# > >> > >> On Tue, Oct 26, 2010 at 3:12 PM, Jan Lehnardt wrote: > >> > >>> Thanks Dave, much appreciated. > >>> > >>> If anybody else wants to beat him to it=85it=92s a public wiki :) > >>> > >>> Cheers > >>> Jan > >>> -- > >>> > >>> On 26 Oct 2010, at 21:56, Dave Cottlehuber wrote: > >>> > >>>> re wiki -> I will add this in next few days. > >>>> > >>>> On 27 October 2010 04:39, Benjamin Young > wrote: > >>>>> On 10/26/2010 11:25 AM, Adam Kocoloski wrote: > >>>>>> > >>>>>> On Oct 26, 2010, at 10:48 AM, Jan Lehnardt wrote: > >>>>>> > >>>>>>> Hi Bram, > >>>>>>> > >>>>>>> On 26 Oct 2010, at 11:51, Bram Neijt wrote: > >>>>>>> > >>>>>>>> I'm a developer at Xebia and I've been granted about 5 hours a > week > >>> to > >>>>>>>> spend on implementing any open source project problem I would li= ke > to > >>>>>>>> see fixed. > >>>>>>> > >>>>>>> This major awesome! :) > >>>>>>> > >>>>>>> > >>>>>>>> I've chosen to have a go at per document authorization for > couchdb. > >>>>>>> > >>>>>>> Uh-oh :) =97 See below. > >>>>>>> > >>>>>>> > >>>>>>>> As I'm weeding through the archives, I would love to hear about > the > >>>>>>>> current approaches, who is involved, what is planned and what ma= y > be > >>>>>>>> considered an acceptable solution. > >>>>>>> > >>>>>>> To get started more generally, it might make sense to check out > >>>>>>> our list of issues sorted by how hard they are to solve: > >>>>>>> > >>>>>>> http://s.apache.org/couchdb-easy-issues > >>>>>>> http://s.apache.org/couchdb-medium-issues > >>>>>>> http://s.apache.org/couchdb-hard-issues > >>>>>>> > >>>>>>> (Thanks again for Paul Davis to produce these lists) > >>>>>>> > >>>>>>> -- > >>>>>>> > >>>>>>> As for per-doc auth: It is very hard to get right and probably > >>>>>>> against the nature of CouchDB. I'm not saying we shouldn't try > >>>>>>> to solve it, but we need to be aware of the impact. > >>>>>>> > >>>>>>> I remember Damien saying that Notes did get per-doc auth, but > >>>>>>> it wasn't a good solution and it sucked ever since. I don't > >>>>>>> think anybody here wants that :) > >>>>>>> > >>>>>>> The biggest problem here are views, the reduced kind. > >>>>>>> > >>>>>>> From the reduce value, CouchDB can't deduce what documents were > >>>>>>> used to create the value. > >>>>>>> > >>>>>>> Imagine three docs > >>>>>>> > >>>>>>> {"name": "a", "amount": 3} > >>>>>>> {"name": "b", "amount": 5} > >>>>>>> {"name": "c", "amount": 7} > >>>>>>> > >>>>>>> A map function: > >>>>>>> > >>>>>>> function(doc) { > >>>>>>> emit(doc.name, doc.amount); > >>>>>>> } > >>>>>>> > >>>>>>> A reduce function: > >>>>>>> > >>>>>>> function(keys, values) { > >>>>>>> return sum(values); > >>>>>>> } > >>>>>>> > >>>>>>> Now the reduced result for this view is 15. Now say you don't > >>>>>>> have access to read the document with `"name": "b"`. Should you > >>>>>>> be able to access the view? If yes, what result should you see? > >>>>>>> 15? 10? > >>>>>>> > >>>>>>> If you get 15, then the view is leaking information that you > >>>>>>> are not supposed to see (IIRC that's how Notes works). > >>>>>>> > >>>>>>> If you are supposed to get 10, the underlying data structure > >>>>>>> would have to compute a view for each user based on his/her > >>>>>>> authorization settings. And invalidate the view every time > >>>>>>> these are changed. > >>>>>>> > >>>>>>> To make a rather straightforward implementation of that, J Chris > >>>>>>> proposed the idea of prefixing views with the username and only > >>>>>>> allowing reads with a prefix that is the authenticated username. > >>>>>>> > >>>>>>> While that is conceptually rather easy, you are basically creatin= g > >>>>>>> a view for each user. This may work for small amounts of data, > >>>>>>> but not large, and many users. > >>>>>>> > >>>>>>> > >>>>>>> Again, I'm not saying, you shouldn't attempt to solve this, > >>>>>>> because that'd be =FCber-rad, but there be dragons :) > >>>>>>> > >>>>>>> Either way, you may want to jump in with the easier open issues > >>>>>>> to get a feeling for the codebase and the procedure of submitting > >>>>>>> patches and all that. > >>>>>>> > >>>>>>> Glad to have you on board! > >>>>>>> > >>>>>>> Cheers > >>>>>>> Jan > >>>>>>> -- > >>>>>> > >>>>>> Well said Jan, and welcome Bram! This explanation needs to not ge= t > >>> lost > >>>>>> in the archives. > >>>>> > >>>>> +1 for getting this on the wiki, a blog, or somewhere that it's > >>> findable. > >>>>> It's sort of become "lore" that per-document permissions aren't > >>> currently > >>>>> doable in CouchDB, but this is the clearest explanation I've heard, > and > >>>>> worth repeating in a more public venue. :) > >>>>> > >>>>> Thanks, Jan, > >>>>> Benjamin > >>>>>> > >>>>>> Adam > >>>>>> > >>>>> > >>>>> > >>> > >>> > >> > >> > >> -- > >> f u cn rd ths u cn b a gd prgmr ! > > > > --=20 f u cn rd ths u cn b a gd prgmr ! --20cf3005129290237c0493af352b--