fix: Escape pipe character in command safety checks and update error message for blocked commands
This commit is contained in:
parent
9054471707
commit
241fb7b140
@ -94,7 +94,7 @@ class TetoCog(commands.Cog):
|
||||
r"shred\s+", # Securely deleting files
|
||||
r"nohup\s+", # Running commands immune to hangups
|
||||
r"&", # Command chaining
|
||||
r"|", # Command piping
|
||||
r"\|", # Command piping (escaped pipe character)
|
||||
r">", # Output redirection
|
||||
r"<", # Input redirection
|
||||
r";", # Command separation
|
||||
@ -168,7 +168,7 @@ class TetoCog(commands.Cog):
|
||||
command, _ = extract_shell_command(ai_content)
|
||||
if command:
|
||||
if self._is_dangerous_command(command):
|
||||
tool_result = "Error: This command is potentially dangerous and cannot be executed."
|
||||
tool_result = "Error: Execution was blocked due to a potentially dangerous command."
|
||||
else:
|
||||
# Execute the shell command
|
||||
tool_result = await self._execute_shell_command(command)
|
||||
|
Loading…
x
Reference in New Issue
Block a user