Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion python/semantic_kernel/connectors/in_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,16 @@ def _get_filtered_records(self, options: VectorSearchOptions) -> dict[TKey, Attr

def _parse_and_validate_filter(self, filter_str: str) -> Callable:
"""Parse and validate a string filter as a lambda expression, then return the callable."""
forbidden_names = {"__import__", "open", "eval", "exec", "__builtins__"}
forbidden_names = {
"__import__",
"open",
"eval",
"exec",
"__builtins__",
"__class__",
"__bases__",
"__subclasses__",
}
try:
tree = ast.parse(filter_str, mode="eval")
except SyntaxError as e:
Expand Down
Loading