Skip to content

[SECURITY] Bound provider and registry response reads #831

Open

Description

@jeffreyaven

Current ownership after the SDK migration

Provider-response read and decompression budgets belong in omnisdk #46: stackql-labs/omnisdk#46. Registry HTTP reads now live in StackQL internal/stackql/registry and must be fixed and tested here. Old any-sdk source links below are historical evidence.

Upstream dependencies

Keep this issue open until the relevant upstream changes are available, any required StackQL integration is complete, and the acceptance checks here pass. Upstream issue closure alone is not sufficient.

Constituent of #769. Reviewed current main at 1de4135 on 2026-10-08; this issue proposes work, no implementation is included.

CWEs: CWE-770.

Finding and evidence

any-sdk materializes provider bodies with io.ReadAll (internal/anysdk/operation_store.go). Registry metadata/document paths also read whole response bodies (internal/anysdk/registry.go). These paths lack a finite total-read budget at the consumption point.

Source review confirms the unbounded reads; no multi-gigabyte payload was downloaded. A malicious/faulty provider or registry, or a client-selected endpoint where permitted, can supply a large/chunked/compressed response. Provider page size and HTTP Content-Length alone are not an enforced byte limit.

Required outcome

  • Enforce configurable finite response budgets with max+1 detection and a clear oversize error; include decompressed/transformed data where expansion occurs.
  • Bound registry fetch duration and handle non-success HTTP status before interpreting/extracting content.
  • Close streams on all failures and propagate cancellation. Support known large provider documents through explicit settings or streaming, not silent truncation.

Validation and acceptance

omnisdk provider tests and StackQL registry tests should use bounded local chunked/compressed fixtures just below/at/above the configured cap, stalled streams, cancellation and HTTP error bodies. A stackql robot query/pull should fail cleanly on oversize input and leave the server usable with no partial cache activation.

Scope and related work

Tar expanded-size/entry limits belong to archive extraction; listener/request admission limits belong to the MCP/pgwire items. This issue is upstream response consumption, including the registry status-code check from baseline section J.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions