Skip to content

[Docker] Read a non-array Engine list body as invalid response - #588

Merged
LarsLaskowski merged 14 commits into
mainfrom
claude/happy-wozniak-73m7oe
Nov 28, 2026
Merged

LarsLaskowski merged 14 commits into
mainfrom
claude/happy-wozniak-73m7oe

Conversation

@LarsLaskowski

@LarsLaskowski LarsLaskowski commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

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, because EnumerateArray threw InvalidOperationException, while a non-object stats or inspect body already read invalid response. RemoteJsonDocument gets ParseArrayAsync, the array counterpart of ParseObjectAsync, and the three Engine call sites use it, so the same malformed answer now reads invalid response whatever 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 shared ParseRootAsync helper; the public parse methods return its task instead of being async, with unchanged behavior) and the three call sites in src/DockerUpdateGuard/Docker/DockerInstanceClient.cs. No catch block, log event or message template changes: the JsonException takes the existing path to invalid 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 RemoteJsonDocumentTests cover ParseArrayAsync (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). DockerInstanceClientListItemsTests covers discovery, resource sampling and image history with {}, a string, a number, true and null roots, 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

  • I have added or updated Unit Tests for the change.
  • I have tested my changes.
  • I have run Format and Build from .squad/stack.md, and the Analyzer gate reports no diagnostic in a changed file.
  • The Coverage gate in .squad/stack.md passes (new or changed production code with the branch conditions its report records, line coverage overall).
  • I have updated the project documentation (README.md, ARCHITECTURE.md) and the area document of every changed behavior to reflect my changes.
  • Each decision with lasting weight has its decision record, committed with the change.
  • I have read the CONTRIBUTING documentation and followed the project's code style guidelines.
  • New dependencies, if any, were added the way Dependencies in .squad/stack.md prescribes.
  • The PR carries its release-notes label (CONTRIBUTING); a change that breaks existing users carries breaking-change and says so in the Description.
  • The C# rules in csharp.instructions.md are followed.

⏭ Next Steps

@LarsLaskowski LarsLaskowski added the bug Something isn't working label Nov 28, 2026 — with Claude
@sonarqubecloud

Copy link
Copy Markdown

@LarsLaskowski
LarsLaskowski marked this pull request as ready for review November 28, 2026 16:16
@LarsLaskowski
LarsLaskowski merged commit 70f80f7 into main Nov 28, 2026
7 checks passed
@LarsLaskowski
LarsLaskowski deleted the claude/happy-wozniak-73m7oe branch November 28, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docker] A Docker Engine container list or image history body that is not a JSON array reads unexpected error

2 participants