Repository navigation
[Docker] Read a non-array Engine list body as invalid response - #588
Merged
Merged
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.



Pull Request
📖 Description
A Docker Engine container list, resource-sampling list or image history whose JSON root is not an array failed with
unexpected error, becauseEnumerateArraythrewInvalidOperationException, while a non-object stats or inspect body already readinvalid response.RemoteJsonDocumentgetsParseArrayAsync, the array counterpart ofParseObjectAsync, and the three Engine call sites use it, so the same malformed answer now readsinvalid responsewhatever its root kind. The host info keeps its lenient parse. Decision record 0075 states the rule; records 0069 and 0074 and the area documents on Docker instances, integration failures and telemetry are updated. The same defect in the .NET release index client is tracked separately.🎫 Issues
Closes #585
Follow-up: #587
💬 Reviewer Notes
Look at
src/DockerUpdateGuard/Infrastructure/RemoteJsonDocument.cs(the sharedParseRootAsynchelper; the public parse methods return its task instead of beingasync, with unchanged behavior) and the three call sites insrc/DockerUpdateGuard/Docker/DockerInstanceClient.cs. No catch block, log event or message template changes: theJsonExceptiontakes the existing path toinvalid response, and a wrong root stops discovery and sampling before any follow-up request. Security areas touched: Docker Engine access and the shared remote JSON parser; no control is created, changed or removed. Record: docs/decisions/0075-a-docker-engine-container-list-or-image-history-that-is-not-a-json-array-is-an-invalid-response.md.📑 Test Plan
New unit tests in
RemoteJsonDocumentTestscoverParseArrayAsync(array roots accepted, every other root kind refused with the fixed message and no inner exception, undecodable strings and their precedence over the root check).DockerInstanceClientListItemsTestscovers discovery, resource sampling and image history with{}, a string, a number,trueandnullroots, including the request counts. The existing history test is renamed and adapted. All tests pass (2365 host, 39 data) and new code is covered 100 %.✅ Checklist
.squad/stack.md, and the Analyzer gate reports no diagnostic in a changed file..squad/stack.mdpasses (new or changed production code with the branch conditions its report records, line coverage overall).README.md,ARCHITECTURE.md) and the area document of every changed behavior to reflect my changes..squad/stack.mdprescribes.breaking-changeand says so in the Description.csharp.instructions.mdare followed.⏭ Next Steps
unexpected error#587