Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-33123

Mongos noscripting command line and configuration

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 3.7.4
    • Affects Version/s: None
    • Component/s: Admin, Sharding
    • Labels:
    • Fully Compatible
    • ALL
    • Platforms 2018-03-26

      mongos --help lists --noscripting as a valid parameter despite not being functional on a mongos. Tested with $where

      --help output:

      root@ip-10-0-8-21:/data/testCluster0_mongos_18# mongos --help | grep scr
        --noscripting                         disable scripting engine
      

      running with --noscripting:

      root@ip-10-0-8-21:/data/testCluster0_mongos_18# ps aux | grep -i mongos
      mongodb   5390  0.1  0.1 335616 24336 ?        Sl   15:30   0:00 /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.4.10-ent/bin/mongos --noscripting -f /var/lib/mongodb-mms-automation/workspace/mongos-testCluster0_mongos_18.conf
      

      test with $where:

      MongoDB Enterprise mongos> db.foo.find()
      { "_id" : 12378, "name" : "Steve", "username" : "steveisawesome", "first_login" : "2017-01-01" }
      { "_id" : 2, "name" : "Anya", "username" : "anya", "first_login" : "2001-02-02" }
      MongoDB Enterprise mongos> db.foo.find( { $where: function() {    return (hex_md5(this.name) == "9b53e667f30cd329dca1ec9e6a83e994") } } );
      { "_id" : 2, "name" : "Anya", "username" : "anya", "first_login" : "2001-02-02" }
      

      If security.javascriptEnabled is in the configuration file for the mongos, the following error blocks startup.

      Unrecognized option: security.javascriptEnabled
      

      When security.javascriptEnabled is set on a shard, the option functions as expected.

      MongoDB Enterprise mongos> db.foo.find( { $where: function() {    return (hex_md5(this.name) == "9b53e667f30cd329dca1ec9e6a83e994") } } );
      Error: error: {
      	"ok" : 0,
      	"errmsg" : "no globalScriptEngine in $where parsing",
      	"code" : 2,
      	"codeName" : "BadValue"
      }
      

      Tested against 3.4.10 and 3.6.2. I will file a docs ticket if this option should not be allowed on a mongos.

            Assignee:
            ben.caimano@mongodb.com Benjamin Caimano (Inactive)
            Reporter:
            stephen.jamieson@mongodb.com Stephen Jamieson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: