fix: enforce record filter client-side (hosted scanner ignores the filter subobject)#59
Merged
Conversation
…ilter subobject The hosted scanner ignores the filter subobject of an OwnedFilter and returns every record the account owns (verified live 2026-07-16), so find(program=..., record=...) and find_credits() could return records from foreign programs — callers would then select records from the wrong program and hit phantom commitments on chain. Add enforce_record_filter() to _scanner_common and apply it to the scanner results in both the sync and async facades (find and the find_credits at_least=None path; find_credits_records already enforces credits-only server-side parsing). Covered by new sync and async tests with mixed-program scanner responses.
Roee-87
approved these changes
Jul 16, 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
The hosted scanner ignores the
filtersubobject of anOwnedFilterand returns every record the account owns (verified live 2026-07-16). That meantrecords.find(program=..., record=...)andrecords.find_credits()could return records from foreign programs — callers selecting a record from the result would then build transactions against the wrong program and hit phantom commitments on chain.Changes
enforce_record_filter()to_scanner_common.pythat applies theprogram/recordsubfilter locally on scanned results.facade/records.py) and async (facade/async_client.py) facades, infind()and thefind_credits(at_least=None)path.Tests
find(program=...),find(record=...), andfind_credits()only return matching records.python -m pytest python/tests/test_facade_records.py python/tests/test_facade_async.py→ 57 passed.