From e63b2a50ec5004ea5364186244a605e81e7b6d16 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 15:57:09 +0200 Subject: [PATCH] growing security --- ereuse_devicehub/resources/action/views/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/resources/action/views/views.py b/ereuse_devicehub/resources/action/views/views.py index 22a1754b..5e5d9945 100644 --- a/ereuse_devicehub/resources/action/views/views.py +++ b/ereuse_devicehub/resources/action/views/views.py @@ -181,7 +181,6 @@ class ActionView(View): def post(self): """Posts an action.""" - # import pdb; pdb.set_trace() json = request.get_json(validate=False) if not json or 'type' not in json: @@ -190,6 +189,10 @@ class ActionView(View): # defs resource_def = app.resources[json['type']] if json['type'] == Snapshot.t: + if json.get('software') == 'Web' and json['device'] == 'Computer': + txt = 'Invalid snapshot' + raise ValidationError(txt) + if json.get('software') == 'Web': snapshot = SnapshotView(json, resource_def, self.schema) return snapshot.post()