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 20DB7C899 for ; Mon, 28 May 2012 12:59:57 +0000 (UTC) Received: (qmail 17623 invoked by uid 500); 28 May 2012 12:59:55 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 17582 invoked by uid 500); 28 May 2012 12:59:55 -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 17574 invoked by uid 99); 28 May 2012 12:59:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 May 2012 12:59:55 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bchesneau@gmail.com designates 209.85.215.52 as permitted sender) Received: from [209.85.215.52] (HELO mail-lpp01m010-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 May 2012 12:59:48 +0000 Received: by lahj13 with SMTP id j13so2452038lah.11 for ; Mon, 28 May 2012 05:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=F0jP5hubeKVIPmv1EPB9CX/J4StERvpaM2eZhhBcqjo=; b=Q4F9F5jsp/7ESJpzooF48jjCtb2/A8yavISk5/5Bkr63aiahH1XDUz0FXSIJk411X2 TxawwJw7QOUUEb+Ma464sPMZIaIpWIAdPeld37ZZ5bQxnsTevhqXsOAUhQIrUy2is+R0 yp8dP/e0VsZS9+37xi4mZE0RapCG0liWvj3VYxTVkWK5L2PMpUgnGNE8j5raKURxg2ib nB72DSyLOJ6KippDFRqnefd/R1IMh0YJr289pGgSG6LQGsu7SHLMHRLjLbFLxy5DeHIe Mi7uz9WgoyJVnTJxnZuagZbJl+2TWywQKrQZy56JMm1SSn0rQN0wplqrZhNHYcVLg410 zA7w== MIME-Version: 1.0 Received: by 10.112.41.35 with SMTP id c3mr3579426lbl.11.1338209967364; Mon, 28 May 2012 05:59:27 -0700 (PDT) Received: by 10.112.28.196 with HTTP; Mon, 28 May 2012 05:59:27 -0700 (PDT) In-Reply-To: References: Date: Mon, 28 May 2012 14:59:27 +0200 Message-ID: Subject: Re: Request object in validate_doc_update From: Benoit Chesneau To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On Fri, May 25, 2012 at 1:43 PM, Luca Matteis wrote: > I have a scenario where I'm building a CouchApp that needs to deny > certain behavior from happening based on the user's IP address. > However, the request object isn't available in validate_doc_update() > functions. > > Would it be good to consider this as a new feature to be implemented? > This would enable people to build much more secure CouchApps, without > having to use proxies/firewalls and such. I personally think that > CouchApps are opening up a whole new paradigm for developing web-apps, > making them really easy to distribute around and to install (think of > kanso), since they only require a simple push to a Couch instance. > > So adding new security features such as this, would enable even more > apps to be built this way. > > What do you think? I'm -1 on that feature. Rather I would prefer to have some extra data added to the userCtx to keep it distinct from the HTTP APIs. Then the HTTP auth handler could add these extra metadat. For example: { "name": "username", "roles": [] "extra": { "ip": ... } } The main point of it is to keep the core db api distinct from HTTP so someone could add its own API level or even change the current HTTP level without impacting low level. - benoit