Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 76349C902 for ; Mon, 28 May 2012 13:12:59 +0000 (UTC) Received: (qmail 54055 invoked by uid 500); 28 May 2012 13:12:57 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 54022 invoked by uid 500); 28 May 2012 13:12:57 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 54014 invoked by uid 99); 28 May 2012 13:12:57 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 May 2012 13:12:57 +0000 Received: from localhost (HELO mail-yw0-f52.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 May 2012 13:12:57 +0000 Received: by yhpp61 with SMTP id p61so1919222yhp.11 for ; Mon, 28 May 2012 06:12:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.173.40 with SMTP id bh8mr4471614igc.65.1338210775951; Mon, 28 May 2012 06:12:55 -0700 (PDT) Received: by 10.42.106.199 with HTTP; Mon, 28 May 2012 06:12:55 -0700 (PDT) In-Reply-To: References: Date: Mon, 28 May 2012 14:12:55 +0100 Message-ID: Subject: Re: Request object in validate_doc_update From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 I disagree that "ip address" should be part of the user context since it's clearly part of the request. As for adding selected parts of the request into the user context in general, I don't see any logic to that and it doesn't seem tidier (the opposite, in fact). Dave asks a great question, should a VDU function be idempotent? Perhaps, but it isn't today anyway. It can vary in its result on different databases and servers based on local security settings (the user doesn't have a role on server A that it does on server B). Given that, it seems fair to allow for a VDU to vary based on any other property of the request (instead of, or in addition to, any properties of the authenticated user, if there is one). Benoit also makes a good point where he urges caution about making VDU a security feature, whereas it has always been intended to ensure you have valid documents (for whatever meaning of 'valid' applies to you). Since this request is in response to a security request (the ability to reject writes from blacklisted IP address or the like) I think that caution is warranted. Perhaps there are two proposals in one here. If we passed the req object to VDU's, we might allow users to build richer applications, but we must be clear that this is not a security mechanism (we've had at least one bug where VDU's were not evaluated after a compaction, for example). The other proposal might be to allow the granting of rights by IP address, much as MySQL does. In fact, I believe this idea is part of the Summit proposal to enhance our security model. I should be able to grant _admin rights to a user if and only if they come from 127.0.0.1, for example. I might also like to exclude all requests from certain IP or IP blocks. I suspect that goes beyond our remit and should be handled by a firewall instead, though. B. On 28 May 2012 14:03, Benoit Chesneau wrote: > On Fri, May 25, 2012 at 1:49 PM, Robert Newson wrote: >> I can't think of a solid objection to this idea. The result of a >> validate_doc_update can already vary based on the local security >> object. Being able to inspect not only the new document, but any other >> property of the request seems useful. >> > > Imo any security things should be distinct from authorization. So > someone can also athenticate itself wh > > We could eventually add some extra data like proposed in my previous > mail, but rather I think having a role given to a user depending on > its IP would work better. And most of systems are working like this > today anyway. > > - benoit