Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8EA6C7AC7 for ; Tue, 20 Sep 2011 07:08:32 +0000 (UTC) Received: (qmail 60758 invoked by uid 500); 20 Sep 2011 07:08:31 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 60672 invoked by uid 500); 20 Sep 2011 07:08:31 -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 60658 invoked by uid 99); 20 Sep 2011 07:08:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2011 07:08:30 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2011 07:08:29 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 0E724A3121 for ; Tue, 20 Sep 2011 07:08:09 +0000 (UTC) Date: Tue, 20 Sep 2011 07:08:09 +0000 (UTC) From: "Benoit Chesneau (JIRA)" To: dev@couchdb.apache.org Message-ID: <1819843365.45093.1316502489055.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1042454867.40917.1316399768852.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-1287) Inbox Database ("write-only" mode) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13108407#comment-13108407 ] Benoit Chesneau commented on COUCHDB-1287: ------------------------------------------ @jason Thanks for the implementation patch. I had a quick look about it. But indeed couch_db:* isn't an appropriate place for that imo, it shouldn't know anything about #httpd{} imo, passing it in the req option is awkward. Maybe we could go to a simpler way ? I was thinking we could allows any readers to do anything but just accept PUT /db/docid and POST /db {...} so no handlers at alls. Which make the test easier imo since you only have to test for "<<"_", _/binary>>. Also rewrite should be disabled for non readers. Thoughts? > Inbox Database ("write-only" mode) > ---------------------------------- > > Key: COUCHDB-1287 > URL: https://issues.apache.org/jira/browse/COUCHDB-1287 > Project: CouchDB > Issue Type: New Feature > Components: HTTP Interface > Affects Versions: 2.0 > Reporter: Jason Smith > Priority: Minor > Attachments: A_0001-Refactor-reader_acl-test-functions-into-a-loop.patch, A_0002-Refactor-the-actual-read-check-out-of-the-member-che.patch, A_0003-Allow-non-member-writes-if-_security.members.allow_a.patch > > > Currently, we can only grant combined read+write access in the _security object "members" section. A user can either do both or neither. This prevents a very common requirement for couch apps: sending private information from less-privileged users to more-privileged users. > There is no (reasonable) way to make an "inbox" where anybody may create a doc for me, but only I may read it. An inbox database allows user-to-user, or user-to-admin private messages. (Not only chat messages, but asynchronous notifications--with a per-user inbox, perhaps even service requests and responses.) > There is no reason _security.members (formerly .readers) should control write access. validate_doc_update() functions do this better. > I propose a boolean flag, _security.members.allow_anonymous_writes. If it is true, then CouchDB will allow document updates from non-members, giving validate_doc_update() the final word on accepting or rejecting the update. > Requirements: > 1. Everything about _security stays the same (backward-compatible) > 2. If members.allow_anonymous_writes === true, then most PUT and POSTs may proceed > 3. All updates are still subject to approval by all validate_doc_update functions, same as before. > The following unit tests cover as much of the functionality as I can think of. (My patch is unfinished but X indicates that I have it working.) > X Set a database with validate_doc_update, members != [] > X member can write > X non-member cannot read > X non-member cannot write > X non-member cannot write even with .is_ok = true > X Set inbox mode > For non-member: > X cannot update with .is_ok = false (still subject to validator) > X can create with .is_ok = true > X can update with .is_ok = true > X Can store an attachment with "_attachments" > X Can store attachments via direct query > X Can delete an attachment via direct query > X can delete the doc > X can create via an _update function > X can update via an _update function > * None of these should work: > X POST a temp view > X POST a view with {"keys":["keys", "which", "exist", "and some which don't"] > * POST /db/exist X-HTTP-Method-Override: GET > * POST /db/_all_docs > * POST /db/_changes > * For _show and _list: > * POST > * OPTIONS > * VARIOUS, NONSTANDARD, METHODS (in case Couch allows them later) > * These syntax/semantic errors in _security should all fail: > * .members.required_to_write = null, [missing], "", 0, true, 1, "false", [false], {false:false} > * .required_to_write = false > These are the known changes to the security model. I consider these all to be either very unlikely in practice, or worth the trade-off. > * If you write to an inbox DB, you know, for a time, a subset of its documents (but that's the point) > * An _update function could reveal a document to the user, with or without changing it. However, an admin must install such a misguided update function. > * You can launch timing attacks to learn information about validate_doc_update > * You might discover whether doc IDs exist in the DB or not > * You might discover a well-known open source validation function. You can look for bugs in its source code. > * Zero or more things which Jason can't think of -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira