Skip to content

Commit

Permalink
reject non-list dashboard layouts (re #25)
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Short authored and jezdez committed Mar 5, 2018
1 parent be89d48 commit 13c37cd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions redash/handlers/dashboards.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from itertools import chain
import json

from flask import request, url_for
from funcy import distinct, project, take
Expand Down Expand Up @@ -128,6 +129,13 @@ def post(self, dashboard_slug):
dashboard = models.Dashboard.get_by_id_and_org(dashboard_slug, self.current_org)

require_object_modify_permission(dashboard, self.current_user)
if 'layout' in dashboard_properties:
try:
layout = json.loads(dashboard_properties['layout'])
except ValueError:
abort(400)
if not isinstance(layout, list):
abort(400)

updates = project(dashboard_properties, ('name', 'layout', 'version',
'is_draft', 'dashboard_filters_enabled'))
Expand Down

0 comments on commit 13c37cd

Please sign in to comment.