mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-22 03:41:43 +00:00
fixed liting errors
This commit is contained in:
parent
9c219db9ba
commit
dc8bdae64f
@ -11,7 +11,6 @@ from concurrent.futures import Executor, ThreadPoolExecutor
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, final
|
||||
|
||||
from jinja2 import Template
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
|
||||
from dbgpt._private.pydantic import ConfigDict, Field
|
||||
@ -43,15 +42,15 @@ class ConversableAgent(Role, Agent):
|
||||
|
||||
# Dangerous template patterns that could lead to code execution
|
||||
_DANGEROUS_TEMPLATE_PATTERNS = [
|
||||
r'\{\{.*__.*\}\}', # Double underscore methods
|
||||
r'\{\{.*import.*\}\}', # Import statements
|
||||
r'\{\{.*exec.*\}\}', # Exec calls
|
||||
r'\{\{.*eval.*\}\}', # Eval calls
|
||||
r'\{\{.*open.*\}\}', # File operations
|
||||
r'\{\{.*subprocess.*\}\}', # Subprocess calls
|
||||
r'\{\{.*os\..*\}\}', # OS module access
|
||||
r'\{\{.*globals.*\}\}', # Globals access
|
||||
r'\{\{.*\[.*\].*\}\}', # Bracket notation access
|
||||
r"\{\{.*__.*\}\}", # Double underscore methods
|
||||
r"\{\{.*import.*\}\}", # Import statements
|
||||
r"\{\{.*exec.*\}\}", # Exec calls
|
||||
r"\{\{.*eval.*\}\}", # Eval calls
|
||||
r"\{\{.*open.*\}\}", # File operations
|
||||
r"\{\{.*subprocess.*\}\}", # Subprocess calls
|
||||
r"\{\{.*os\..*\}\}", # OS module access
|
||||
r"\{\{.*globals.*\}\}", # Globals access
|
||||
r"\{\{.*\[.*\].*\}\}", # Bracket notation access
|
||||
]
|
||||
|
||||
agent_context: Optional[AgentContext] = Field(None, description="Agent context")
|
||||
@ -1115,7 +1114,7 @@ class ConversableAgent(Role, Agent):
|
||||
def _render_bind_prompt(
|
||||
self,
|
||||
resource_vars: Optional[Dict] = None,
|
||||
context: Optional[Dict[str, Any]] = None
|
||||
context: Optional[Dict[str, Any]] = None,
|
||||
) -> str:
|
||||
"""Render bind prompt template with sanitized parameters."""
|
||||
prompt_param = {}
|
||||
|
Loading…
Reference in New Issue
Block a user