incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: "safe" access to CouchDB?
Date Tue, 03 Feb 2009 16:27:41 GMT
On Mon, Feb 2, 2009 at 11:49 PM, Rich Morin <rdm@cfcl.com> wrote:
> I'm interested in finding out how to provide "safe" access to
> CouchDB from untrusted (and possibly malicious) code.  What
> can I do to allow queries, but make sure that no destructive
> activities (including major denials of service) are allowed?
>

If you want to avoid denial of service, you should not allow
temp_views to be generated by end-users.

For document control, if your application can set a trusted "author"
field on the doc (perhaps from session) then you can use CouchDB's
validation functions in a bunch of interesting ways.

Sofa has a fairly complex validation function which manages both blog
posts and anonymous comments:
http://github.com/jchris/sofa/blob/master/validate_doc_update.js

Line 20 of that validation function is my hack to provide some more
session support for Sofa admins. It's not a good pattern to follow but
you shouldn't need to do it if you have an application server. Fixing
sofa's sign-in hack is on my todo list.

Or see the test suite for more examples.

-- 
Chris Anderson
http://jchris.mfdz.com

Mime
View raw message