diff --git a/python/semantic_kernel/connectors/in_memory.py b/python/semantic_kernel/connectors/in_memory.py index ff9cc65a116d..b90ba71bf999 100644 --- a/python/semantic_kernel/connectors/in_memory.py +++ b/python/semantic_kernel/connectors/in_memory.py @@ -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: