mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Ensure that tokens are hex to avoid hanging/errors in cherrypy
This commit is contained in:
parent
4d865b4b9e
commit
652dbf63f4
1 changed files with 12 additions and 1 deletions
|
@ -1078,6 +1078,13 @@ class LowDataAdapter(object):
|
|||
if cherrypy.session.get('groups'):
|
||||
chunk['__current_eauth_groups'] = cherrypy.session.get('groups')
|
||||
|
||||
if 'token' in chunk:
|
||||
# Make sure that auth token is hex
|
||||
try:
|
||||
int(chunk['token'], 16)
|
||||
except (TypeError, ValueError):
|
||||
raise cherrypy.HTTPError(401, 'Invalid token')
|
||||
|
||||
if client:
|
||||
chunk['client'] = client
|
||||
|
||||
|
@ -2078,7 +2085,11 @@ class Events(object):
|
|||
|
||||
:return bool: True if valid, False if not valid.
|
||||
'''
|
||||
if auth_token is None:
|
||||
# Make sure that auth token is hex. If it's None, or something other
|
||||
# than hex, this will raise a ValueError.
|
||||
try:
|
||||
int(auth_token, 16)
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
# First check if the given token is in our session table; if so it's a
|
||||
|
|
Loading…
Add table
Reference in a new issue