From dev-return-7278-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Sun Nov 15 00:43:11 2009 Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 71371 invoked from network); 15 Nov 2009 00:43:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Nov 2009 00:43:10 -0000 Received: (qmail 73034 invoked by uid 500); 15 Nov 2009 00:43:10 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 72949 invoked by uid 500); 15 Nov 2009 00:43:10 -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 72939 invoked by uid 99); 15 Nov 2009 00:43:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Nov 2009 00:43:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Nov 2009 00:43:00 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8C597234C045 for ; Sat, 14 Nov 2009 16:42:39 -0800 (PST) Message-ID: <1909886251.1258245759560.JavaMail.jira@brutus> Date: Sun, 15 Nov 2009 00:42:39 +0000 (UTC) From: "Paul Joseph Davis (JIRA)" To: dev@couchdb.apache.org Subject: [jira] Commented: (COUCHDB-558) Validate Content-MD5 request headers on uploads In-Reply-To: <82731282.1257191699494.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COUCHDB-558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778031#action_12778031 ] Paul Joseph Davis commented on COUCHDB-558: ------------------------------------------- Filipe, Overall it looks pretty good, but a couple points: * We should probably be checking the Content-MD5 before we process the request. * check_integrity should probably throw an error or return the body * You should still be recording stats even when validation fails * There are alot of variable assignments where they aren't necessary. * keep lines less than 80 characters * The perl in the JS test is ungood. Either paste it here, or better, use an Erlang test to check. * really_long_function_names_are_hard_to_read - The functions for trailers could be made more generic. * The check for Content-MD5 appears to be case sensitive * get_has_from_trailer is weird... oh its an rstrip. There's probably a better way to do that. Try referencing how Mochiweb parses its headers. I think the idea is pretty solid. The only thing I'm a bit concerned about is the trailier parsing. The current bits are a bit awkard. In a perfect world id prefer to see that as a patch to mochiweb, but having it in CouchDB is fine if they rejected that patch or during the time it takes to get into upstream. Also, if you take the approach of having your hash matching function just throw an error that will get caught by the try/catch around the HandleReq() call, it should simplify a whole lot of this. If none of that makes any sense let me know and I'll refactor the patch locally to try and explain things more concretely. > Validate Content-MD5 request headers on uploads > ----------------------------------------------- > > Key: COUCHDB-558 > URL: https://issues.apache.org/jira/browse/COUCHDB-558 > Project: CouchDB > Issue Type: Improvement > Components: Database Core, HTTP Interface > Reporter: Adam Kocoloski > Fix For: 0.11 > > Attachments: jira-couchdb-558-for-trunk-2nd-try.patch, jira-couchdb-558-for-trunk.patch > > > We could detect in-flight data corruption if a client sends a Content-MD5 header along with the data and Couch validates the MD5 on arrival. > RFC1864 - The Content-MD5 Header Field > http://www.faqs.org/rfcs/rfc1864.html -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.