Repository navigation
Description
Follow-up to #5711 / #5716, filed on the code review's recommendation so the decision does not get lost.
Context
#5716 made the HTTP query and command endpoints honor a limit the caller stated - the request's limit field, or the LIMIT the query carries - and cap only the callers that state none, with arcadedb.server.httpQueryDefaultLimit (default 20000).
The consequence is that the default cap now protects only queries that state no limit of their own. An authenticated caller who writes SELECT FROM HugeType LIMIT 100000000 (or sends "limit": -1) makes the server serialize an arbitrarily large result into a single JSON response.
This is not a new capability: "limit": -1 has always been an unbounded escape hatch for the same actor, so no privilege boundary moved. What changed is the bar - a large LIMIT in the query text is easier to reach accidentally (e.g. an application that builds LIMIT n from user input) than an explicit limit: -1 in the request body. In a multi-tenant deployment the previous implicit 20,000 cap was doing real protective work.
Proposal
Mirror what the gRPC path already does. arcadedb.server.grpcQueryMaxResultRows is documented as:
Hard ceiling on the number of rows the gRPC unary ExecuteQuery materializes. A request limit at or below this cap is honored; a result that would exceed it fails the call with RESOURCE_EXHAUSTED (consistent with the StreamQuery MATERIALIZE_ALL path) rather than silently truncating, and a client cannot bypass it with a larger limit.
An HTTP equivalent - arcadedb.server.httpQueryMaxResultRows - would answer 413 (or 400) naming the setting when the requested cap exceeds it, and would never truncate silently, which keeps the invariant #5711 established.
The decision this needs
Any finite default is a breaking change for deployments that send limit: -1 today and get everything. So the options are:
- Default
-1(disabled): fully backward compatible, but provides no protection out of the box - an operator has to know the setting exists. - A finite default (e.g. 1,000,000): protects by default, breaks existing unbounded callers at the next upgrade, and needs a release note under Breaking Changes.
- Finite default only in the
productionserver mode, unlimited indevelopment.
Option 3 is arguably the best of the three but adds mode-dependent behaviour to a data path, which has its own cost.
Notes
- The timeseries query endpoint materializes its whole range before applying any limit, so a ceiling there would have to bound the fetch, not just the serialization, to be worth anything.
- Whatever is chosen, the ceiling must fail loudly rather than truncate - a silently truncated response is the defect HTTP query endpoint silently truncates at 20,000 rows: a truncated response is indistinguishable from a complete one #5711 fixed.
Activity
fix(#5719): a single HTTP response is bounded by a ceiling no caller …
fix(#12016): the HTTP response cap reaches the engine as a bound on t…