fix(extensions): reject malformed progress receipts - #3104
Open
tang-vu wants to merge 1 commit into
Open
Conversation
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
Why this matters
The dashboard API reads progress receipts written across the host-agent boundary. A truncated writer is already handled as invalid JSON, but valid JSON such as
null, an array, or a scalar currently either crashes object consumers with.get/item-assignment errors or leaks a scalar from the public progress endpoint. That can turn an install failure into a second 500 and leaves the UI without its stable{service_id, status}contract.Behavioral invariant
An extension progress receipt is usable only when its JSON root is an object. Every other root shape is treated as absent, and recording a terminal error repairs the receipt to an object.
Overlap check
Searched open and closed upstream PRs for extension progress receipts, malformed JSON/document shapes, and the changed production/test files. #3065 changes frontend polling concurrency only; merged #1056 covers catalog timeouts and merged #1724 covers model actions. None validates the backend receipt root or repairs a malformed receipt, so this scope is independent.
Validation
pytest -q tests/test_extensions.py -k 'non_object_progress or non_object_receipts or progress_endpoint_during_install or sets_error_status'? 12 passedpytest -q tests/test_extensions.py? 265 passed, 5 skippedpython -m compileall -q routers/extensions.py tests/test_extensions.pygit diff --checkTradeoffs and rollback
Malformed receipts are deliberately treated like missing state rather than surfaced as an API error, matching the existing invalid-JSON behavior. Files are not deleted, preserving host diagnostics. Reverting this commit restores the prior permissive JSON-root behavior.