Permalink
Browse files

Detect nonstandard ddoc languages

  • Loading branch information...
1 parent 9e91a1b commit d6e66e8df911fcea5af3c1ccaf93af09e7f7342a @jhs committed Feb 21, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 audit_couchdb.js
View
@@ -27,6 +27,14 @@ function CouchAudit(url) {
this.low("Database is unauthorized: " + url);
})
+ self.on('ddoc', function(db_url, ddoc, info) {
+ if(ddoc.language !== info.view_index.language)
+ throw new Error("Different languages in ddoc vs. index info: " + JSON.stringify(info) + " vs. language = " + JSON.stringify(ddoc.language));
+
+ if(ddoc.language !== 'javascript')
+ this.medium("Non-standard language '" + ddoc.language + '": ' + lib.join(db_url, ddoc._id));
+ })
+
self.on('end', function() {
console.log("DONE!");
})

0 comments on commit d6e66e8

Please sign in to comment.