2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-23 01:53:28 +00:00

Apply whitelist to rpc functions in configmanager

This commit is contained in:
Jarrod Johnson 2020-01-27 15:59:22 -05:00
parent 4c8ba92856
commit 0652a7321b

View File

@ -609,6 +609,8 @@ def relay_slaved_requests(name, listener):
rpc += nrpc
rpc = msgpack.unpackb(rpc)
exc = None
if not (rpc['function'].startswith('_rpc_') or rpc['function'].endswith('_collective_member')):
raise Exception('Unsupported function {0} called'.format(rpc['function']))
try:
globals()[rpc['function']](*rpc['args'])
except Exception as e:
@ -765,6 +767,8 @@ def follow_channel(channel):
if 'txcount' in rpc:
_txcount = rpc['txcount']
if 'function' in rpc:
if not (rpc['function'].startswith('_true') or rpc['function'].startswith('_rpc')):
raise Exception("Received unsupported function call: {0}".format(rpc['function']))
try:
globals()[rpc['function']](*rpc['args'])
except Exception as e: