Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/areas/base-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ a base-image update or vulnerability reaches; vulnerability refreshes and the da

- **.NET:** `releases-index.json` under `DockerUpdateGuard:ReleaseMetadata:DotNetBaseUrl` (default
`https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/`). Per channel (`channel-version`) the latest
runtime (`latest-runtime`) and whether that release is a security release (`security`).
runtime (`latest-runtime`) and whether that release is a security release (`security`). An entry of `releases-index`
that is not a JSON object is left out; the other entries still count.
- **nginx:** the `download/` page under `DockerUpdateGuard:ReleaseMetadata:NginxBaseUrl` (default
`https://nginx.org/`). Every `nginx-x.y.z.tar.gz` link counts; a channel's latest is its highest version.
- Both URLs are fixed at startup and must be absolute `http`/`https` URLs without an `@` outside their user info ([Hosting](hosting.md)). A feed is loaded at
Expand Down Expand Up @@ -140,12 +141,14 @@ a base-image update or vulnerability reaches; vulnerability refreshes and the da
- Chain depth is capped at 5; base-tag resolution searches at most 150 tags.
- Registry outcomes other than *succeeded* never abort the scan; they set *partial* or *failed* and add the registry's
message (status code and an excerpt of the response body, see [Integration failures](integration-failures.md#excerpts-of-remote-text)).
- Feed failures (non-success status, missing `releases-index` array, unreadable content) only suppress the runtime
- Feed failures (non-success status, missing `releases-index` array, unreadable content: malformed JSON, a string that does not decode, or a root that is
not a JSON object) only suppress the runtime
finding and keep the previous one (observed image and running container); they do not change the scan status.
Unreadable content is logged as a warning.

## Related decisions

- [0076: The .NET release index is parsed as a remote JSON object, and an entry that is not one is left out](../decisions/0076-the-dotnet-release-index-is-parsed-as-a-remote-json-object-and-an-entry-that-is-not-one-is-left-out.md)
- [0054: A base image is shared from two users among enabled observed images and their containers](../decisions/0054-a-base-image-is-shared-from-two-users-among-enabled-observed-images-and-their-containers.md)
- [0042: A runtime container keeps its derived runtime finding while its runtime check cannot be completed](../decisions/0042-a-runtime-container-keeps-its-derived-runtime-finding-while-its-runtime-check-cannot-be-completed.md)

Expand Down
8 changes: 5 additions & 3 deletions docs/areas/integration-failures.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ operator's logs rely on it; each integration area states only what it adds.
failed` (transport failures and responses that break off), `invalid response` or `unexpected error`. The error
itself is logged with the failure (a JSON parse failure with a fixed message, [Telemetry](telemetry.md#credentials-and-external-data)).
- `invalid response` covers malformed JSON and a JSON string that does not decode as Unicode text, such as a lone
surrogate escape like `\ud800` or bytes that are not UTF-8, a registry answer, or a Docker Engine stats or image inspect answer, whose root is not a JSON object, a Docker Engine container list or image history whose root is not a JSON array, and a Docker Hub access token whose payload segment is not
base64url. The Docker Hub, OCI and Docker Engine clients refuse the
surrogate escape like `\ud800` or bytes that are not UTF-8, a registry answer, a Docker Engine stats or image inspect answer, or the .NET release index, whose root is not a JSON object, a Docker Engine container list or image history whose root is not a JSON array, and a Docker Hub access token whose payload segment is not
base64url. The Docker Hub, OCI and Docker Engine clients and the .NET release feed refuse the
whole body for one in any string value or property name; the Portainer client and the vulnerability providers for one
in a field they read; the release feeds report it as `unexpected error`.
in a field they read.
- A message the application composed itself from fixed text, configuration names and masked URLs
([Telemetry](telemetry.md#credentials-and-external-data)), and for a rejected registration the stored name of an own
image with its control characters replaced, is passed on as it is; it never contains an error's own
Expand Down Expand Up @@ -185,6 +185,8 @@ negative or an unreadable number is unknown), and the .NET release feed's `lates
remembered process-wide.
- [0019](../decisions/0019-remote-json-with-undecodable-strings-is-an-invalid-response.md): remote JSON with a string
that does not decode is an invalid response.
- [0076](../decisions/0076-the-dotnet-release-index-is-parsed-as-a-remote-json-object-and-an-entry-that-is-not-one-is-left-out.md): the .NET
release index is parsed as a remote JSON object and an entry that is not one is left out.
- [0029](../decisions/0029-registry-calls-answer-every-error-but-the-callers-cancellation-as-failed.md): registry calls
answer every error but the caller's cancellation as *failed*.
- [0066](../decisions/0066-remote-timestamps-without-an-offset-are-read-as-utc.md): remote timestamps without an
Expand Down
2 changes: 1 addition & 1 deletion docs/areas/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Every exported signal carries the same resource:
- A JSON parse failure of a remote answer, a token payload, the .NET release index or Trivy's report is logged with a
fixed message, never the parser's: `Remote JSON is not valid at line <l>, byte <b> (counted from 0)`, with the
parser's line and byte position in invariant digits, or `Remote JSON is not valid` when the position is unknown. The
exception has no path and no inner exception, so it carries no remote text; the refusal of a string that does not decode ([Integration failures](integration-failures.md#fixed-failure-reasons)) keeps its own fixed message and its decoding error, which carries no remote text either; the refusal of a registry answer, or of a Docker Engine stats or image inspect answer, whose root is not a JSON object carries the fixed message `The remote response is not a JSON object` and no inner exception; the refusal of a Docker Engine container list or image history whose root is not a JSON array carries `The remote response is not a JSON array` and no inner exception. Every parse of external JSON goes through
exception has no path and no inner exception, so it carries no remote text; the refusal of a string that does not decode ([Integration failures](integration-failures.md#fixed-failure-reasons)) keeps its own fixed message and its decoding error, which carries no remote text either; the refusal of a registry answer, of a Docker Engine stats or image inspect answer, or of the .NET release index, whose root is not a JSON object carries the fixed message `The remote response is not a JSON object` and no inner exception; the refusal of a Docker Engine container list or image history whose root is not a JSON array carries `The remote response is not a JSON array` and no inner exception. Every parse of external JSON goes through
`Infrastructure\ExternalJson`. A `Content-Type` charset that cannot be used is refused with the fixed message `The
character set of the remote response is not valid` and no inner exception. Decision:
[0045](../decisions/0045-json-parse-failures-of-external-data-carry-a-fixed-message-with-their-position.md).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 0076: The .NET release index is parsed as a remote JSON object, and an entry that is not one is left out

- **Status:** Accepted
- **Date:** 2026-11-28
- **Area:** Base images
- **Source:** Issue #587
- **Supersedes:** 0019 β€” amends its consequence that the release feeds keep reporting a body with a string that does not decode as `unexpected error`: the .NET release index now reads `invalid response` for it.

## Context

The .NET release feed's `releases-index.json` is a JSON object whose `releases-index` array holds one object per
channel. `DotNetReleaseMetadataService` parsed it with `ExternalJson` and read its properties without checking the kind
of the root or of an entry, so a root that is not an object, an entry that is not one, or a string that does not decode
made the reader throw `InvalidOperationException`, and the fixed reason
([0009](0009-integration-results-carry-fixed-failure-reasons.md)) was `unexpected error`. The Docker Hub, OCI and Docker
Engine clients answer `invalid response` for such a body
([0073](0073-a-registry-answer-that-is-not-a-json-object-is-an-invalid-response-and-an-entry-that-is-not-one-is-left-out.md),
[0074](0074-a-docker-engine-stats-or-image-inspect-answer-that-is-not-a-json-object-is-an-invalid-response.md),
[0019](0019-remote-json-with-undecodable-strings-is-an-invalid-response.md)) and leave a non-object entry out
([0069](0069-a-docker-engine-list-item-that-is-not-a-json-object-is-left-out.md)). 0019 left the release feeds out
because their text reaches no message. The feed's message reaches no page or scan run either: a failure only suppresses
the runtime finding and is logged as warning 2101. The planning of #585 found the difference.

## Options considered

1. **Parse the index with `RemoteJsonDocument.ParseObjectAsync` and leave out an entry that is not an object (chosen)**
β€” the rule of 0073-0075 through the one helper that holds it; a malformed root and an undecodable string read
`invalid response` as in every other `JsonDocument` client.
2. **Check the root and answer the existing message for a missing `releases-index` array** β€” true for such a root,
but that message describes a well-formed index without the field, differs from the other clients' reason, and
leaves undecodable strings at `unexpected error`.
3. **A root check of its own that throws `JsonException`, without decoding the strings** β€” keeps tolerating an
undecodable string in a field the service never reads, but not in one it reads, and copies a check
`RemoteJsonDocument` holds once ([0075](0075-a-docker-engine-container-list-or-image-history-that-is-not-a-json-array-is-an-invalid-response.md), option 4).
4. **Keep `unexpected error`** β€” two reasons for one malformed body, and a reason that reads like an error of the
application (0074, option 2).
5. **Map `InvalidOperationException` to `invalid response`** β€” rejected by 0019 and
[0029](0029-registry-calls-answer-every-error-but-the-callers-cancellation-as-failed.md) for the misuse the runtime
reports with the same type.
6. **Refuse the whole index for an entry that is not an object** β€” the other entries still carry data (0069, 0073).

## Decision

Option 1: the .NET release index is parsed as a remote JSON object and refused as an invalid response otherwise or
when one of its strings does not decode; an entry of `releases-index` that is not a JSON object is left out. The rules
are in [Base images](../areas/base-images.md#release-feeds-and-runtime-findings) and
[Integration failures](../areas/integration-failures.md#fixed-failure-reasons).

## Consequences

- The feed's failed result reads `invalid response` instead of `unexpected error` for such a body, and warning 2101
logs the refusal's fixed message; the runtime finding is suppressed as before.
- One undecodable string anywhere in the index, also in a field the service never reads, now fails the whole index,
where before only one in a field it reads did; Microsoft's feed is conforming JSON, so this is accepted.
- A malformed entry no longer hides the other channels of the index.
1 change: 1 addition & 0 deletions docs/decisions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,5 @@ once in the [area document](../areas/README.md) of the record's area, and the re
| [0073](0073-a-registry-answer-that-is-not-a-json-object-is-an-invalid-response-and-an-entry-that-is-not-one-is-left-out.md) | A registry answer that is not a JSON object is an invalid response, and an entry that is not one is left out | Accepted | 2026-11-28 |
| [0074](0074-a-docker-engine-stats-or-image-inspect-answer-that-is-not-a-json-object-is-an-invalid-response.md) | A Docker Engine stats or image inspect answer that is not a JSON object is an invalid response | Accepted | 2026-11-28 |
| [0075](0075-a-docker-engine-container-list-or-image-history-that-is-not-a-json-array-is-an-invalid-response.md) | A Docker Engine container list or image history that is not a JSON array is an invalid response | Accepted | 2026-11-28 |
| [0076](0076-the-dotnet-release-index-is-parsed-as-a-remote-json-object-and-an-entry-that-is-not-one-is-left-out.md) | The .NET release index is parsed as a remote JSON object, and an entry that is not one is left out | Accepted | 2026-11-28 |
<!-- project:end index -->
9 changes: 7 additions & 2 deletions src/DockerUpdateGuard/Images/DotNetReleaseMetadataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ private async Task<ExternalOperationResult<bool>> LoadIndexAsync(CancellationTok

await using (responseStream.ConfigureAwait(false))
{
using var jsonDocument = await ExternalJson.ParseAsync(responseStream, cancellationToken)
.ConfigureAwait(false);
using var jsonDocument = await RemoteJsonDocument.ParseObjectAsync(responseStream, cancellationToken)
.ConfigureAwait(false);

if (jsonDocument.RootElement.TryGetProperty("releases-index", out var releasesIndexElement) == false
|| releasesIndexElement.ValueKind != JsonValueKind.Array)
Expand All @@ -163,6 +163,11 @@ private async Task<ExternalOperationResult<bool>> LoadIndexAsync(CancellationTok

foreach (var releaseElement in releasesIndexElement.EnumerateArray())
{
if (releaseElement.ValueKind != JsonValueKind.Object)
{
continue;
}

var channelVersion = TryGetString(releaseElement, "channel-version");
var latestRuntime = TryGetString(releaseElement, "latest-runtime");

Expand Down
Loading