Do not use eval() to convert unknown types (#23266)

Signed-off-by: Russell Bryant <rbryant@redhat.com>
This commit is contained in:
Russell Bryant 2025-08-20 16:28:30 -04:00 committed by GitHub
parent bf7c99dfc4
commit 4e51fa8cba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -208,15 +208,10 @@ class Qwen3CoderToolParser(ToolParser):
"valid JSON object in tool '%s', will try other " "valid JSON object in tool '%s', will try other "
"methods to parse it.", param_value, param_name, "methods to parse it.", param_value, param_name,
func_name) func_name)
try: logger.warning(
converted_value = eval(param_value) "Parameter '%s' has unknown type '%s'. "
return converted_value "The value will be treated as a string.", param_name,
except Exception: param_type)
logger.warning(
"Parsed value '%s' of parameter '%s' cannot be "
"converted via Python `eval()` in tool '%s', "
"degenerating to string.", param_value, param_name,
func_name)
return param_value return param_value
# Extract function name # Extract function name