experimental[patch]: block a few more things from PALValidator (#24379)

* Please see security warning already in existing class.
* The approach here is fundamentally insecure as it's relying on a block
  approach rather than an approach based on only running allowed nodes.
So users should only use this code if its running from a properly
sandboxed  environment.
This commit is contained in:
Eugene Yurtsev 2024-07-18 08:22:45 -04:00 committed by GitHub
parent 0dec72cab0
commit 6182a402f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,13 +20,21 @@ from langchain_experimental.pal_chain.math_prompt import MATH_PROMPT
from langchain_experimental.pydantic_v1 import Extra, Field, root_validator
from langchain_experimental.utilities import PythonREPL
COMMAND_EXECUTION_FUNCTIONS = ["system", "exec", "execfile", "eval", "__import__"]
COMMAND_EXECUTION_FUNCTIONS = [
"system",
"exec",
"execfile",
"eval",
"__import__",
"compile",
]
COMMAND_EXECUTION_ATTRIBUTES = [
"__import__",
"__subclasses__",
"__builtins__",
"__globals__",
"__getattribute__",
"__code__",
"__bases__",
"__mro__",
"__base__",