Browse Source

csvimport: Return error if input is not valid UTF-8

pull/380/head
Jakub Onderka 2 years ago committed by GitHub
parent
commit
fe34023866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      misp_modules/modules/import_mod/csvimport.py

6
misp_modules/modules/import_mod/csvimport.py

@ -256,7 +256,11 @@ def handler(q=False): @@ -256,7 +256,11 @@ def handler(q=False):
return False
request = json.loads(q)
if request.get('data'):
data = base64.b64decode(request['data']).decode('utf-8')
try:
data = base64.b64decode(request['data']).decode('utf-8')
except UnicodeDecodeError:
misperrors['error'] = "Input is not valid UTF-8"
return misperrors
else:
misperrors['error'] = "Unsupported attributes type"
return misperrors

Loading…
Cancel
Save