Hartmut
1ff5c3377c
security: block raw/tx escape hatches on read-only AI DB proxy ( #47 )
...
The read-only proxy previously wrapped model delegates to block writes,
but left client-level raw/escape hatches ($transaction, $executeRaw,
$executeRawUnsafe, $queryRawUnsafe, $runCommandRaw) intact. A read-tool
could smuggle DML via raw SQL, or open an interactive $transaction whose
tx-scoped client (unproxied by construction) accepts writes.
- read-only-prisma: block $transaction, $executeRaw, $executeRawUnsafe,
$queryRawUnsafe, $runCommandRaw at the client level. Template-tagged
$queryRaw stays allowed (read-only by API contract).
- assistant-tools: add create_estimate to MUTATION_TOOLS — it uses
$transaction internally and was previously bypassing the proxy only
because $transaction wasn't blocked.
- shared: document isReadOnly flag on ToolContext so any scoped tRPC
caller a tool spawns keeps the proxied client.
- helpers: note the runtime wrap at assistant-tools.ts:739 is
authoritative; forwarding ctx.db verbatim is correct.
- tests: cover model writes, raw escapes, and the allowed $queryRaw
path (7 cases, all pass).
- loosen one estimate-detail test that compared the exact db instance
(fails once that instance is a proxy; the assertion's intent is the
estimate id).
Covers EGAI 4.1.1.2 / IAAI 3.6.22.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-04-17 08:38:05 +02:00
..
2026-04-11 08:09:39 +02:00
2026-04-17 08:38:05 +02:00
2026-04-10 15:28:12 +02:00
2026-03-31 10:30:28 +02:00
2026-03-31 13:15:44 +02:00
2026-03-31 12:16:20 +02:00
2026-03-31 10:30:28 +02:00
2026-03-28 22:49:28 +01:00
2026-03-31 22:44:54 +02:00
2026-03-31 22:44:54 +02:00
2026-04-01 07:42:03 +02:00
2026-04-09 21:14:26 +02:00
2026-03-31 10:30:28 +02:00
2026-04-01 07:42:03 +02:00
2026-04-17 08:38:05 +02:00
2026-03-31 22:44:54 +02:00
2026-03-31 13:41:08 +02:00
2026-03-31 21:11:19 +02:00
2026-03-31 12:09:24 +02:00
2026-03-31 21:11:19 +02:00
2026-04-17 08:19:33 +02:00
2026-04-11 08:35:02 +02:00
2026-04-11 08:35:02 +02:00
2026-04-06 00:11:12 +02:00
2026-03-31 20:15:19 +02:00
2026-03-31 21:15:02 +02:00
2026-03-31 14:00:22 +02:00
2026-03-31 21:15:02 +02:00
2026-04-09 08:35:13 +02:00
2026-03-31 20:42:33 +02:00
2026-04-09 20:03:38 +02:00
2026-03-31 13:45:53 +02:00
2026-03-31 20:15:25 +02:00
2026-04-01 23:25:06 +02:00
2026-03-31 14:28:07 +02:00
2026-03-31 19:16:57 +02:00
2026-03-31 22:19:09 +02:00
2026-03-31 22:19:09 +02:00
2026-03-31 21:24:28 +02:00
2026-03-31 22:12:02 +02:00
2026-03-31 11:28:18 +02:00
2026-03-31 22:12:02 +02:00
2026-03-31 22:14:53 +02:00
2026-03-31 22:01:29 +02:00
2026-03-31 10:41:24 +02:00
2026-03-31 10:41:24 +02:00
2026-03-31 22:16:31 +02:00
2026-03-31 22:16:31 +02:00
2026-03-31 10:12:05 +02:00
2026-03-31 21:24:28 +02:00
2026-03-31 20:25:11 +02:00
2026-03-31 13:54:22 +02:00
2026-04-10 15:28:12 +02:00
2026-03-27 13:18:09 +01:00
2026-03-31 22:26:52 +02:00
2026-04-09 13:28:46 +02:00
2026-04-10 15:28:12 +02:00
2026-03-31 14:31:59 +02:00
2026-03-31 14:31:59 +02:00
2026-03-31 20:32:59 +02:00
2026-03-31 12:13:28 +02:00
2026-03-31 20:32:59 +02:00
2026-04-09 16:40:10 +02:00
2026-03-31 14:05:20 +02:00
2026-03-31 19:59:36 +02:00
2026-04-09 20:14:35 +02:00
2026-03-31 21:05:56 +02:00
2026-04-09 16:40:10 +02:00
2026-04-11 22:59:45 +02:00
2026-03-31 11:30:38 +02:00
2026-04-09 16:40:10 +02:00
2026-03-31 09:16:46 +02:00
2026-04-09 16:40:10 +02:00
2026-03-31 22:45:05 +02:00
2026-04-09 16:40:10 +02:00
2026-03-31 14:07:21 +02:00
2026-03-31 20:02:15 +02:00
2026-03-31 14:24:46 +02:00
2026-04-09 13:28:46 +02:00
2026-04-01 07:35:34 +02:00
2026-03-31 09:05:18 +02:00
2026-03-31 14:24:46 +02:00
2026-03-31 13:25:27 +02:00
2026-03-31 20:25:17 +02:00
2026-04-09 16:40:10 +02:00
2026-03-31 20:36:46 +02:00
2026-04-09 14:44:51 +02:00
2026-03-31 11:33:36 +02:00
2026-03-31 22:53:53 +02:00
2026-03-31 20:31:55 +02:00
2026-04-17 08:19:33 +02:00
2026-03-31 20:04:17 +02:00
2026-03-31 13:52:24 +02:00
2026-03-31 20:04:17 +02:00
2026-04-09 08:35:13 +02:00
2026-04-09 21:38:16 +02:00
2026-03-31 21:56:15 +02:00
2026-03-31 21:56:15 +02:00
2026-04-01 07:42:03 +02:00
2026-03-31 20:50:14 +02:00
2026-03-31 20:28:13 +02:00
2026-03-31 13:55:47 +02:00
2026-03-31 20:28:13 +02:00
2026-03-31 13:25:20 +02:00
2026-04-10 15:28:12 +02:00
2026-03-31 08:57:21 +02:00
2026-03-31 08:54:52 +02:00
2026-04-09 16:40:10 +02:00
2026-04-10 15:28:12 +02:00
2026-03-27 13:18:09 +01:00
2026-03-31 21:28:56 +02:00
2026-04-09 13:28:46 +02:00
2026-03-31 13:25:20 +02:00
2026-04-10 15:28:12 +02:00
2026-03-31 14:33:38 +02:00
2026-04-09 13:28:46 +02:00
2026-03-31 14:33:38 +02:00
2026-03-31 14:30:29 +02:00
2026-03-31 19:56:14 +02:00
2026-04-01 07:42:03 +02:00
2026-04-01 07:42:03 +02:00
2026-04-01 07:42:03 +02:00
2026-04-01 07:42:03 +02:00
2026-04-01 07:42:03 +02:00
2026-04-01 07:42:03 +02:00
2026-03-31 10:09:02 +02:00
2026-03-31 21:59:10 +02:00
2026-04-01 07:42:03 +02:00
2026-04-01 07:42:03 +02:00
2026-03-31 08:34:38 +02:00
2026-04-09 08:35:13 +02:00
2026-04-09 08:35:13 +02:00
2026-04-09 13:28:46 +02:00
2026-04-01 07:38:03 +02:00
2026-03-31 08:05:45 +02:00
2026-04-09 08:35:13 +02:00
2026-04-11 23:23:43 +02:00
2026-04-09 13:28:46 +02:00
2026-04-09 13:28:46 +02:00
2026-04-09 19:31:50 +02:00
2026-03-31 07:57:39 +02:00
2026-03-31 08:34:38 +02:00
2026-04-09 13:28:46 +02:00
2026-04-10 15:28:12 +02:00
2026-03-31 08:34:38 +02:00
2026-04-09 20:03:38 +02:00
2026-03-31 13:40:55 +02:00
2026-03-31 21:22:44 +02:00
2026-04-09 08:34:59 +02:00
2026-03-31 11:03:50 +02:00
2026-04-09 14:38:32 +02:00
2026-03-31 11:03:50 +02:00
2026-03-31 11:03:50 +02:00
2026-03-31 19:18:56 +02:00
2026-03-31 19:46:50 +02:00
2026-04-09 21:38:16 +02:00
2026-04-09 08:35:39 +02:00
2026-03-31 22:45:00 +02:00
2026-04-10 15:28:12 +02:00
2026-03-31 22:45:00 +02:00
2026-04-09 13:28:46 +02:00
2026-04-10 15:28:12 +02:00
2026-03-31 11:26:45 +02:00
2026-03-31 22:54:33 +02:00
2026-03-31 14:00:26 +02:00
2026-04-10 15:28:12 +02:00
2026-03-31 18:08:19 +02:00
2026-03-31 17:57:28 +02:00
2026-04-09 13:28:46 +02:00
2026-03-31 17:59:16 +02:00
2026-04-01 07:42:03 +02:00
2026-03-31 18:00:23 +02:00
2026-04-01 07:42:03 +02:00
2026-03-31 18:08:19 +02:00
2026-03-31 17:55:52 +02:00
2026-04-01 07:42:03 +02:00
2026-03-31 17:57:28 +02:00
2026-03-31 17:59:16 +02:00
2026-03-31 17:53:59 +02:00
2026-03-31 17:53:59 +02:00
2026-03-31 18:18:52 +02:00
2026-03-31 15:46:17 +02:00
2026-03-31 18:56:01 +02:00
2026-03-31 17:30:04 +02:00
2026-03-31 15:54:56 +02:00
2026-04-11 22:59:45 +02:00
2026-03-31 18:53:20 +02:00
2026-03-31 18:56:01 +02:00
2026-03-31 15:18:43 +02:00
2026-04-10 15:28:12 +02:00
2026-03-31 15:52:31 +02:00
2026-03-31 18:48:48 +02:00
2026-03-31 17:30:04 +02:00
2026-03-31 17:26:42 +02:00
2026-03-31 17:32:43 +02:00
2026-03-31 18:49:51 +02:00
2026-03-31 16:01:35 +02:00
2026-03-31 16:01:35 +02:00
2026-03-31 18:56:01 +02:00
2026-03-31 18:56:01 +02:00
2026-04-09 13:28:46 +02:00
2026-03-31 07:45:15 +02:00
2026-03-31 15:50:17 +02:00
2026-03-27 13:18:09 +01:00
2026-03-31 17:50:36 +02:00
2026-03-31 18:15:38 +02:00
2026-03-31 17:50:36 +02:00
2026-03-31 18:15:38 +02:00
2026-04-17 08:13:25 +02:00
2026-04-17 08:19:33 +02:00
2026-04-10 15:28:12 +02:00
2026-04-11 22:59:45 +02:00
2026-03-31 13:49:10 +02:00
2026-03-31 21:09:13 +02:00
2026-03-31 11:08:58 +02:00
2026-04-09 13:28:46 +02:00
2026-04-10 15:09:16 +02:00
2026-04-09 13:28:46 +02:00
2026-04-09 08:35:13 +02:00
2026-03-31 22:42:00 +02:00
2026-04-01 07:35:34 +02:00
2026-03-31 11:02:40 +02:00
2026-04-10 15:28:12 +02:00
2026-04-01 18:19:21 +02:00
2026-03-31 13:41:02 +02:00
2026-03-31 21:18:29 +02:00