Skip to content

Commit de39128

Browse files
fix: python.lang.security.audit.eval-detected.eval-detected-python-helpers-memory.py (#444)
Co-authored-by: Harshit-65 <[email protected]>
1 parent 490f469 commit de39128

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/helpers/memory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import ast
12
from datetime import datetime
23
from typing import Any, List, Sequence
34
from langchain.storage import InMemoryByteStore, LocalFileStore
@@ -391,7 +392,7 @@ def _save_db_file(db: MyFaiss, memory_subdir: str):
391392
def _get_comparator(condition: str):
392393
def comparator(data: dict[str, Any]):
393394
try:
394-
return eval(condition, {}, data)
395+
return ast.literal_eval(condition, {}, data)
395396
except Exception as e:
396397
# PrintStyle.error(f"Error evaluating condition: {e}")
397398
return False

0 commit comments

Comments
 (0)