[SERVER-33123] Mongos noscripting command line and configuration Created: 05/Feb/18  Updated: 29/Oct/23  Resolved: 22/Mar/18

Status: Closed
Project: Core Server
Component/s: Admin, Sharding
Affects Version/s: None
Fix Version/s: 3.7.4

Type: Bug Priority: Trivial - P5
Reporter: Stephen Jamieson Assignee: Benjamin Caimano (Inactive)
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 2018-03-26
Participants:
Case:

 Description   

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.



 Comments   
Comment by Githook User [ 24/Jul/18 ]

Author:

{'name': 'Asya Kamsky', 'email': 'asya999@gmail.com', 'username': 'asya999'}

Message: Mongos does not support --noscripting

see https://jira.mongodb.org/browse/SERVER-33123
Branch: master
https://github.com/mongodb/docs/commit/e02b34229af1c832ceb83e7419b7f3b6f979b853

Comment by Githook User [ 22/Mar/18 ]

Author:

{'email': 'ben.caimano@10gen.com', 'name': 'Ben Caimano'}

Message: SERVER-33123 Mongos noscripting command line and configuration

Hid --noscripting, added and hid security.javascriptEnabled, warned on
set for mongos.
Branch: master
https://github.com/mongodb/mongo/commit/e11d931c36605ea6616b57662b723a51aea01478

Comment by Benjamin Caimano (Inactive) [ 16/Mar/18 ]

It appears that `--noscripting` is explicitly unsupported in the `mongos` source code. I'll be looking into suppressing the argument in the help. Additionally, I'll try to make the parameter in the configuration warn instead of block.

Generated at Thu Feb 08 04:32:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.