Repository navigation
🐛 fix(query): reject malformed candidates - #231
Merged
Merged
Conversation
A named executable can print JSON without running the collector, and a partial payload can deserialize into a PythonInfo missing required fields. Reject missing query markers and incomplete data so discovery tries the next candidate. Fixes tox-dev#197
gaborbernat
force-pushed
the
bug/reject-wrong-shape-json
branch
from
November 3, 2026 04:57
5fdf325 to
75e541f
Compare
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.
The subprocess probe accepted exit-zero JSON without confirming it came from the interpreter collector. Empty objects raised during deserialization, and partial objects raised during interpreter resolution, stopping discovery before it tried the next PATH candidate. The probe now rejects responses without the collector's markers or required interpreter fields. Fixes #197.
The response lacked the collector's markers
The collector wraps its JSON in two query markers. The old probe parsed output even when the markers were absent. The probe now rejects that output, so a program that ignores the collector script cannot supply a result by printing JSON.
Deserialization accepted incomplete objects
The old
from_dict()restoredversion_infoand copied the remaining keys without checking whether the collector's required fields existed. It now rejects missing fields. The probe treats malformed results as failed queries, and the cache discards incomplete entries.Behavior changes
Discovery retries a failed query and continues to later candidates on PATH when a candidate omits query markers or required metadata. Direct
PythonInfo.from_dict()andfrom_json()calls raiseValueErrorfor objects missing required fields. A candidate that reproduces both markers and all required fields can still supply false values; the query protocol does not authenticate subprocess output.Reported by Anthropic's OSS Scanner: ANT-2026-T9IA1FTF.