From 4377f17748ad3c450d8c542be5e156830d24e95a Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Mon, 19 Jun 2017 01:35:33 -0400 Subject: [PATCH] bugfix and sanity check on device IDs and device public key query strings --- blockstack_client/rpc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/blockstack_client/rpc.py b/blockstack_client/rpc.py index 3e5148c3c..93a15b989 100644 --- a/blockstack_client/rpc.py +++ b/blockstack_client/rpc.py @@ -1282,6 +1282,9 @@ class BlockstackAPIEndpointHandler(SimpleHTTPRequestHandler): app_public_keys = ','.join( [apk['public_key'] for apk in ses['app_public_keys']] ) else: + if qs_device_ids is None or qs_device_pubkeys is None: + return self._reply_json({'error': 'Missing either device_ids= or device_pubkeys= query arguments'}, status_code=401) + device_ids = [urllib.unquote(dev_id) for dev_id in qs_device_ids.split(',')] app_public_keys = qs_device_pubkeys.split(',') @@ -1505,7 +1508,7 @@ class BlockstackAPIEndpointHandler(SimpleHTTPRequestHandler): """ if datastore_id != ses['app_user_id']: - return self._reply_json({'error': 'Invalid datastore ID'}, status=403) + return self._reply_json({'error': 'Invalid datastore ID'}, status_code=403) if inode_type not in ['files', 'directories']: log.debug("Invalid request: unrecognized inode type")