[SERVER-11015] REST queries on documents containing javascript content returns incorrect JSON Created: 03/Oct/13 Updated: 11/Jul/16 Resolved: 20/Dec/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | HTTP Console, Internal Code |
| Affects Version/s: | 2.4.3 |
| Fix Version/s: | 2.5.5 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | David Regnier | Assignee: | Shaun Verch |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
platform independant |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Steps To Reproduce: | Issue reproduced via this specific use case: 1/ enable REST on the database Arbitrary example: var i = 0; ; 5/ do a REST query on the "system.profile" collection for "demo" (for example: http://localhost:28017/demo/system.profile/) Resulting JSON is incorrect (javascript command is not escaped) See attached file "json_profiles.json". |
||||||||
| Participants: | |||||||||
| Description |
|
If the content of a JSON document value is javascript, the result of a query via the REST interface does not escape this javascript content. (tested via a query on "system.profiles" collection -> profiles having commands with javascript content). |
| Comments |
| Comment by Githook User [ 20/Dec/13 ] | |||||||||||||||||||||||
|
Author: {u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}Message: | |||||||||||||||||||||||
| Comment by Shaun Verch [ 30/Oct/13 ] | |||||||||||||||||||||||
|
This is an also an issue for mongoexport since it's an issue with how we convert the BSON code type to JSON.
| |||||||||||||||||||||||
| Comment by Shaun Verch [ 30/Oct/13 ] | |||||||||||||||||||||||
|
Reproduced and confirmed:
I believe our options are either to add something to http://docs.mongodb.org/manual/reference/mongodb-extended-json/ to allow us to represent code objects in strict JSON format or to just output it as a string. |