Python: Extend InMemoryCollection filter attribute blocklist#13897
Merged
moonbox3 merged 1 commit intomicrosoft:mainfrom Apr 22, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Hardens InMemoryCollection’s string-filter sandboxing by expanding the blocked attribute set and adding a regression test to ensure common introspection/function-internals dunder attributes are rejected during filter parsing.
Changes:
- Add
__base__to theblocked_filter_attributesset used by the in-memory filter validator/evaluator. - Add a parametrized unit test asserting several dangerous dunder attributes are rejected with a clear error.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/semantic_kernel/connectors/in_memory.py | Extends the filter attribute blocklist to include __base__ (defense-in-depth against sandbox escape chains). |
| python/tests/unit/connectors/memory/test_in_memory.py | Adds regression coverage to ensure key blocked dunder attributes are consistently rejected. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
eavanvalkenburg
approved these changes
Apr 21, 2026
TaoChenOSU
approved these changes
Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InMemoryCollectionfilter parsing.Test plan
uv run pytest tests/unit/connectors/memory/test_in_memory.py