Skip to content

fix(dockermeta): stream Docker list/inspect bodies; 4 MiB per-container limits - #314

Merged
randomizedcoder merged 1 commit into
mainfrom
sec/dockermeta-stream
Nov 23, 2026
Merged

randomizedcoder merged 1 commit into
mainfrom
sec/dockermeta-stream

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

Follow-up to #312: replaces its whole-body caps, which let one container with oversized labels fail every re-list for the host.

  • Streaming JSON walker (jsonwalk.go): validates the full body and keeps only the projected fields; memory stays about 37 KiB per walk.
  • Per-container limits: maxInspectBody and maxListEntry are 4 MiB. Over the limit, only that container is skipped and logged; the list still builds.
  • No list total: 16 padded containers would trip a 64 MiB total. requestTimeout (10 s) bounds a body that never ends.
  • Kept strings: Id and SandboxKey over 4 KiB skip the container; Name and Image are cut at 4 KiB, before strpolicy's 256 B cut.
  • Parity: differential tests and fuzzers check the walker against encoding/json (case folding, duplicate keys, null, depth 10000, invalid UTF-8).
  • Tests: TestTenantBodySize (exactly at and one byte over each limit, 17 × 4 MiB entries), TestRequestTimeout, TestDecodeInspect, TestDecodeIDs, FuzzDecodeIDs.
  • Docs: "Docker API limits" in design-metadata-enrichment.md, hardening row C5, plan TODO closed, CHANGELOG.
  • Verified: full go test ./...; 2 min fuzz of each target (about 7.7 M execs, no divergence); lint-baseline, golangci tiers, gofmt, go-vet.

🤖 Generated with Claude Code

…er limits

Replace the whole-body caps with a streaming JSON walker that keeps only
the projected fields and skips the rest without buffering. An oversized
container is skipped alone instead of failing the whole re-list.

- maxInspectBody / maxListEntry = 4 MiB per container; no list total
- maxIDRaw / maxTextRaw = 4 KiB for kept strings
- requestTimeout = 10 s per Docker API request
- walker matches encoding/json accept/reject (differential tests + fuzz)
- limits documented in design-metadata-enrichment.md and hardening C5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@randomizedcoder
randomizedcoder merged commit 4bf2056 into main Nov 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant