RipcordSoftware / AvanceDB

An in-memory database based on the CouchDB REST API and containing the CouchDB Futon and Fauxton web sites
GNU Affero General Public License v3.0
161 stars 12 forks source link

SpiderMonkey runtimes are unlocked and can be modified #39

Open craigminihan opened 8 years ago

craigminihan commented 8 years ago

It is possible for map/reduce functions to modify the JS global object. This state will persist between calls and could be exploited.

Using JS_DeepFreezeObject on the global prevents new code (map/reduce) being run in the thread context since it prevents any modifications being made to the runtime.

Ideally the map function should not be able to modify the global object or alternately the global object should be reset at the end of the map/reduce pass.