Commit f2bda1db authored by Yori Fournier's avatar Yori Fournier
Browse files

in mpl_client.py: in read_data(): add a test to check that the io_function is...

in mpl_client.py: in read_data(): add a test to check that the io_function is a String and not a function object.
                                  The problem with function objects is that it may be a security issue. The server
	                          has a limited allowed functions (known_functions).
                                  If io_function is not a string, a WARNING is thrown and io_function
				  is replaced with io_function.__name__.
parent fccd0143
Pipeline #672 failed with stage
in 25 minutes and 18 seconds
......@@ -123,6 +123,11 @@ class MplClient():
def read_data(self, io_function, data_name, *args, **kwargs):
# create a Signal of type Query with arguments
self.connect((self.host, self.port))
if not isinstance(io_function, str): # in case function is given instead of string
io_function = io_function.__name__
print('WARNING: You gave the function object instead of the function name in cilent.read_data.')
query = Query(Query.READDATA, {'func': io_function,
'data_name': data_name,
'args': args,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment