Skip to content

Commit 98c8126

Browse files
committed
Workaround potential JSON XSRF attacks in browsers
1 parent 0b31cc9 commit 98c8126

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

occi/http/content_json.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ def _render_obj_list(self, objects):
8484
json_data = []
8585
for obj in objects:
8686
json_data.append(self._json_obj(obj))
87-
return json_data
87+
88+
# Workaround JSON array vulnerability in browser JavaScript
89+
# implementations
90+
return { 'collection': json_data }
8891

8992
def _json_obj(self, obj):
9093
"""Render `DataObject` into a JSON-friendly dictionary structure.
@@ -164,7 +167,6 @@ def _json_obj(self, obj):
164167

165168
return json_obj
166169

167-
168170
def register():
169171
register_parser(CONTENT_TYPE, JSONParser)
170172
register_renderer(CONTENT_TYPE, JSONRenderer)

0 commit comments

Comments
 (0)