Files
Daniel Salazar bfcacc8469 fix(db): bound numbers must be safe integers; path, cursor and lookup input checks (#4708)
* fix(db): bound numbers must be safe integers; path and cursor input checks

Bound numbers outside ±2^53 (including NaN and Infinity) are refused with a
400 by every database client.

- Paths longer than 4096 characters are refused with a 400.
- The path lineage lookup returns null for paths deeper than its walk
  without querying.
- The read batcher's circuit breaker counts a failed fallback flush only
  when an item could not reach the database.
- App, subdomain and worker list cursors must carry a non-negative integer
  id.
- App stats grouping accepts only its own keys.
- App batch lookups skip values of the wrong type, and app writes refuse
  keys that are not column names.
- User, notification, durable subscription and KV share handle lookups
  return no row for values of the wrong type.
- OIDC links are looked up by the sub as a string.
- User-to-user and group permission reads keep exact matches only.
- revoke-dev-app validates its parameters like grant-dev-app.
- A durable subscription's expiresAt must be before the year 10000.
- Installed apps paging reads page and limit as whole numbers.

* fix(db): review follow-ups for input checks

- The path length check measures the canonical absolute path, after the
  leading slash is added and a trailing one dropped.
- The lineage lookup handles up to 500 segments, SQLite's compound select
  limit.
- Group permission reads keep matching by the column's collation.
- A server error code is never read as a lost connection from its message.
- Cursor ids must be integers or digit strings, and a cursor that is
  neither a string nor an object is refused.
- OIDC links store the sub as a string, matching lookups.
- findEmailOwner returns no row for a value that is not a string.
- Invalid stats groupings and non-string or non-number expiresAt values
  return a 400.
- Installed apps limit clamps before rounding down.
2026-11-19 15:19:28 -07:00
..