in flink-python/pyflink/pyflink_gateway_server.py [0:0]
def read_from_config(key, default_value, flink_conf_file):
value = default_value
# get the realpath of tainted path value to avoid CWE22 problem that constructs a path or URI
# using the tainted value and might allow an attacker to access, modify, or test the existence
# of critical or sensitive files.
with open(os.path.realpath(flink_conf_file), "r") as f:
while True:
line = f.readline()
if not line:
break
if line.startswith("#") or len(line.strip()) == 0:
continue
k, v = line.split(":", 1)
if k.strip() == key:
value = v.strip()
return value