You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ra...@apache.org on 2017/05/15 20:43:46 UTC

[couchdb] branch master updated: Re-enable js eval view sandbox test

This is an automated email from the ASF dual-hosted git repository.

randall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

The following commit(s) were added to refs/heads/master by this push:
       new  153f40f   Re-enable js eval view sandbox test
153f40f is described below

commit 153f40fb6ad4c33aa5cbdf12b12944929a4cf1ab
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Mon May 15 13:33:33 2017 -0700

    Re-enable js eval view sandbox test
---
 test/javascript/tests/view_sandboxing.js | 39 ++++++++++++++------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/test/javascript/tests/view_sandboxing.js b/test/javascript/tests/view_sandboxing.js
index 171777b..9e7fa86 100644
--- a/test/javascript/tests/view_sandboxing.js
+++ b/test/javascript/tests/view_sandboxing.js
@@ -145,10 +145,12 @@ couchTests.view_sandboxing = function(debug) {
   }
 */
 
+  // cleanup
+  db.deleteDb();
+
   // test that runtime code evaluation can be prevented
-  console.log('TODO: config port not available on cluster');
-  /*var couchjs_command_xhr = CouchDB.request(
-    "GET", "/_config/query_servers/javascript");
+  var couchjs_command_xhr = CouchDB.request(
+    "GET", "_node/node1@127.0.0.1/_config/query_servers/javascript");
 
   var couchjs_command = JSON.parse(couchjs_command_xhr.responseText);
   var couchjs_command_args = couchjs_command.match(/\S+|"(?:\\"|[^"])+"/g);
@@ -161,31 +163,24 @@ couchTests.view_sandboxing = function(debug) {
       key: "javascript",
       value: new_couchjs_command}],
     function () {
-      var ddoc = {
-        _id: "_design/foobar",
-        language: "javascript",
-        views: {
-          view: {
-            map:
-            (function(doc) {
-              var glob = emit.constructor('return this')();
-              emit(doc._id, null);
-            }).toString()
-          }
-        }
-      };
-
-      db.deleteDb();
+      CouchDB.request("POST", "_reload_query_servers");
+
+      db_name = get_random_db_name();
+      db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
       db.createDb();
-      T(db.save(ddoc).ok);
 
+      var doc = {integer: 1, string: "1", array: [1, 2, 3]};
       T(db.save(doc).ok);
-      var results = db.view(
-        "foobar/view", {bypass_cache: Math.round(Math.random() * 1000)});
+
+      var results = db.query(function(doc) {
+          var glob = emit.constructor('return this')();
+          emit(doc._id, null);
+      });
 
       TEquals(0, results.rows.length);
-    });*/
+    });
 
   // cleanup
+  CouchDB.request("POST", "_reload_query_servers");
   db.deleteDb();
 };

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].