Skip to content

Agent Zero AI framework

refactor: mask secrets in code execution command output and increase truncation limit

frdel6181ac9c204e
diff --git a/plugins/_code_execution/tools/code_execution_tool.py b/plugins/_code_execution/tools/code_execution_tool.py
index 46319677b..88478bc82 100644
--- a/plugins/_code_execution/tools/code_execution_tool.py
+++ b/plugins/_code_execution/tools/code_execution_tool.py
@@ -5,7 +5,7 @@ import shlex
import time
from helpers.tool import Tool, Response
-from helpers import files, rfc_exchange, projects, runtime, settings
+from helpers import files, rfc_exchange, projects, runtime, secrets, settings
from helpers.print_style import PrintStyle
from helpers.strings import truncate_text as truncate_text_string
from helpers.messages import truncate_text as truncate_text_agent
@@ -200,8 +200,9 @@ class CodeExecution(Tool):
raise e
def format_command_for_output(self, command: str):
- short_cmd = command[:200]
+ short_cmd = command[:250]
short_cmd = " ".join(short_cmd.split())
+ short_cmd = secrets.get_secrets_manager(self.agent.context).mask_values(short_cmd)
short_cmd = truncate_text_string(short_cmd, 100)
return f"{short_cmd}"