Skip to content

Production compose turns on delegated SQL caveats (TC-1791) - #682

Merged
samgbafa merged 9 commits into
mainfrom
feat/tc-1791-caveats-on
Nov 22, 2026
Merged

samgbafa merged 9 commits into
mainfrom
feat/tc-1791-caveats-on

Conversation

@samgbafa

@samgbafa samgbafa commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Turns on delegated SQL caveats in production (finish-or-kill T5, Sam's "everything ships live" order, 2026-11-21). Config only, no code and no migration.

Change

  • docker-compose.dstack-postgres.yaml and the tc959 N0 fixture: add TINYCLOUD_SQL__DELEGATED_CAVEATS_ENFORCED: "true".
  • docker.yml n0_template_hash and docs/releasing.md: template e5f1c356d68fe9dfac3d1f93109ded95108a8def42984b4bbeab1a29c5ee05ea, raw d1d2ef49…, covering retention (Production compose turns the retention sweeper back on (TC-287) #690) plus caveats. Before: e1cf031b… / f4f51e75….
  • CHANGELOG [Unreleased].

Why no existing user breaks

  • With the setting off, a tinycloud.sql/* delegation carrying tables/columns/readOnly is refused at /delegate with 401 (CHANGELOG TC-1791 entry). So no stored chain carries these caveats.
  • No client sends invocation sqlCaveats (rg sqlCaveats across js-sdk, tinychat and openkey src: none). exec_caveats therefore stays None (routes/mod.rs:3296-3299), and SQL without caveats behaves as before.
  • New behaviour: caveated SQL delegations are admitted and enforced, with 403 sql_caveat_violation outside them, and /info lists sql-delegated-caveats-v1.

Deploy order: merge after #678 (1.26.18) and deploy in its own window: a bump-only release, then Naomi's head-named GO.

  • Live check: /info features include sql-delegated-caveats-v1.
  • Rollback: remove the line in the next compose.

Verified locally: python3 scripts/ci/test-deploy-recovery.py passes (30 tests); the fixture is byte-equal to the compose.

Details: TC-1791

- docker-compose.dstack-postgres.yaml and the tc959 N0 fixture: TINYCLOUD_SQL__DELEGATED_CAVEATS_ENFORCED: "true".
- docker.yml n0_template_hash and docs/releasing.md: template 6c9ff33f..., raw c64a6e2b... (6a577c6d... / 272f43b8... before).
- CHANGELOG [Unreleased] entry.
- Off, a caveated SQL delegation is refused at /delegate, so no stored chain carries caveats and SQL without them is unchanged.

Details: TC-1791
…ted rules (TC-1791)

- Bobbie's #682 note (a): with the flag on, a request carrying sqlCaveats facts goes through delegated_denial (case-insensitive names; INSERT/DELETE under a columns list and PRAGMA answer 403). No client sends facts today.

Details: TC-1791
# Conflicts:
#	.github/workflows/docker.yml
#	CHANGELOG.md
#	docs/releasing.md
# Conflicts:
#	.github/workflows/docker.yml
#	docs/releasing.md
# Conflicts:
#	.github/workflows/docker.yml
#	docs/releasing.md
…ith caveats enforced

- With delegated_caveats_enforced on, a `[{}]` or `[]` sql/write grant admitted by the real /delegate runs unrestricted reads (any column, sqlite_master), writes and batches.
- The js-sdk readSql form (constrained-statements profile on the grant and the invocation, executeStatement with params: []) runs with fixedParams injected; a raw query under it is refused.

test-ruling: TC-1791 tinycloud-node-server/src/routes/mod.rs new test only (2026-11-22)

Details: TC-1791
@samgbafa
samgbafa marked this pull request as ready for review November 22, 2026 05:40
@samgbafa
samgbafa merged commit 24f4157 into main Nov 22, 2026
33 checks passed
@samgbafa
samgbafa deleted the feat/tc-1791-caveats-on branch November 22, 2026 05:40
samgbafa pushed a commit that referenced this pull request Nov 22, 2026
… part 5)

- Re-pin canonical fields.json to tinycloud-dev 29ee97f9 (#364): pool_wait_ms, query_time_ms (number 0..86400000), query_count (integer 0..2^53-1).
- sanitize.vrl copies the three fields only on node_request with status < 400, type- and bound-guarded; anything else is dropped and the event still ships (Naomi ruling A, 05:22Z).
- budget: node (status 399 + DB fields) sizes the request allocation (774 B pair, 14.36 rpm); nodeCapped (no DB fields) sizes the capped classes, reserve unchanged at 585.4 MB.
- Vector cases: valid, maxima, mistyped, out-of-bounds, and statuses 399..599 (4xx/5xx carry none). Compose embed regeneration follows after #682 and T3.
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