Skip to content

Commit

Permalink
fix: bug in malicious code scan (#1341)
Browse files Browse the repository at this point in the history
  • Loading branch information
shoebham authored Oct 16, 2024
1 parent 2e17812 commit f7aa3fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pandasai/pipelines/chat/code_cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _is_malicious_code(self, code) -> bool:
"(chr",
"b64decode",
]
return any(module in code for module in dangerous_modules)
return any(re.search(r'\b'+re.escape(module)+r'\b',code) for module in dangerous_modules)

def _is_jailbreak(self, node: ast.stmt) -> bool:
"""
Expand Down

0 comments on commit f7aa3fc

Please sign in to comment.