mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
When making auth calls, only username, password, auth, and token are valid, so we strip anything else out.
This commit is contained in:
parent
d6f4f055f5
commit
3dbe8dc8be
2 changed files with 20 additions and 1 deletions
|
@ -93,9 +93,14 @@ class LoadAuth(object):
|
|||
fstr = '{0}.auth'.format(load['eauth'])
|
||||
if fstr not in self.auth:
|
||||
return False
|
||||
# When making auth calls, only username, password, auth, and token
|
||||
# are valid, so we strip anything else out.
|
||||
_valid = ['username', 'password', 'eauth', 'token']
|
||||
_load = {key: value for (key, value) in load.items() if key in _valid}
|
||||
|
||||
fcall = salt.utils.args.format_call(
|
||||
self.auth[fstr],
|
||||
load,
|
||||
_load,
|
||||
expected_extra_kws=AUTH_INTERNAL_KEYWORDS)
|
||||
try:
|
||||
if 'kwargs' in fcall:
|
||||
|
|
|
@ -191,6 +191,20 @@ class TestRun(cptc.BaseRestCherryPyTest):
|
|||
})
|
||||
assert response.status == '401 Unauthorized'
|
||||
|
||||
def test_run_extra_parameters(self):
|
||||
'''
|
||||
Test the run URL with good auth credentials
|
||||
'''
|
||||
cmd = dict(self.low, **dict(self.auth_creds))
|
||||
cmd['id_'] = 'someminionname'
|
||||
body = urlencode(cmd)
|
||||
|
||||
request, response = self.request('/run', method='POST', body=body,
|
||||
headers={
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
})
|
||||
self.assertEqual(response.status, '200 OK')
|
||||
|
||||
|
||||
class TestWebhookDisableAuth(cptc.BaseRestCherryPyTest):
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue