@substrat-run/contracts 0.95.0 → 0.95.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -171,4 +171,46 @@ export declare const directoryBackup: z.ZodObject<{
171
171
  tables: z.ZodNumber;
172
172
  }, z.core.$strip>;
173
173
  export type DirectoryBackup = z.infer<typeof directoryBackup>;
174
+ /**
175
+ * Throw naming the offending identifier, or return it.
176
+ *
177
+ * Exported because a caller that reads names one at a time — walking `sqlite_master`
178
+ * in a file it was handed, say — has to check each one at the point it interpolates
179
+ * it, not as a batch afterwards.
180
+ */
181
+ export declare function assertSqlIdentifier(name: string, what: string): string;
182
+ /** Every table and column name in a dump, checked before any of them reaches SQL. */
183
+ export declare function assertDumpIdentifiers(tables: {
184
+ name: string;
185
+ columns?: string[];
186
+ }[]): void;
187
+ /**
188
+ * A dumped table's schema is exactly one `CREATE TABLE` for the name the dump
189
+ * declared — checked BEFORE it runs, because a check that runs afterwards has
190
+ * already let the statement happen.
191
+ *
192
+ * Both halves are load-bearing, and the second is the one that is easy to miss.
193
+ * Executing a table's `ddl` runs EVERY statement the text contains — `db.exec` on
194
+ * better-sqlite3 and `SqlStorage.exec` on a Durable Object both do — so
195
+ * `CREATE TABLE x (id TEXT); ATTACH DATABASE '/tmp/out' AS e;` executed both halves
196
+ * with two entirely plain identifiers, and nothing an identifier check adds would
197
+ * have caught it. Pinning the head alone is not enough either: a trailing statement
198
+ * rides in behind a perfectly honest `CREATE TABLE`.
199
+ *
200
+ * Refusing beats relying on the driver to compile only the first statement. That is
201
+ * true of better-sqlite3's `prepare` and NOT true of a Durable Object, which has no
202
+ * prepare step at all — so a rule that leaned on it would hold in the CLI and quietly
203
+ * fail on the hosted path, which is the one that matters most.
204
+ */
205
+ export declare function assertSingleCreateTable(ddl: string, name: string): void;
206
+ /**
207
+ * Everything a dump must satisfy before any of it reaches SQL: its identifiers, and
208
+ * one `CREATE TABLE` per table. The single entry point a replay site calls, so a new
209
+ * one cannot pick up half the rules.
210
+ */
211
+ export declare function assertReplayableDump(tables: {
212
+ name: string;
213
+ ddl: string;
214
+ columns?: string[];
215
+ }[]): void;
174
216
  //# sourceMappingURL=introspection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"introspection.d.ts","sourceRoot":"","sources":["../src/introspection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;iBAIrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;iBAOzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAI5D,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAKtE,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;iBAE1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;iBAI3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc;;;;;iBAYzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,c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CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,GAAG,IAAI,CAwB1F;AAmED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAiBvE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,GAAG,IAAI,CAGtG"}
@@ -172,4 +172,173 @@ export const directoryBackup = z.object({
172
172
  /** Tables carried; zero means the copy is not restorable. */
173
173
  tables: z.number().int().nonnegative(),
174
174
  });
175
+ /**
176
+ * ## Replaying a dump: a dump is untrusted input at every site that replays it
177
+ *
178
+ * A `ScopeDumpTable` names its own tables and columns and carries its own schema
179
+ * text, and all three reach SQL as TEXT — a bind parameter can stand in for a value
180
+ * but never for an identifier, and never for a `CREATE TABLE`. So the quoting used to
181
+ * be the only thing in the way, and a crafted name walks straight out of it:
182
+ *
183
+ * ```
184
+ * x") ; ATTACH DATABASE '/tmp/pwned.db' AS e; --
185
+ * ```
186
+ *
187
+ * Three call sites replay a dump — the CLI's `scope pull`/`restore`, the SQLite
188
+ * adapter's `loadDump`, and the two Durable Object paths (`scope-do`, `control-plane-do`).
189
+ * The checks live HERE, beside the schema they judge, because the alternative is the
190
+ * same security rule written three times and fixed in one of them. #1143.
191
+ *
192
+ * The rule is **refuse the backup**, not quote harder. Every table a substrat scope
193
+ * holds is a plain word, so a name that is not one is corruption or an attack, and
194
+ * neither is worth loading.
195
+ */
196
+ const SQL_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
197
+ /**
198
+ * Throw naming the offending identifier, or return it.
199
+ *
200
+ * Exported because a caller that reads names one at a time — walking `sqlite_master`
201
+ * in a file it was handed, say — has to check each one at the point it interpolates
202
+ * it, not as a batch afterwards.
203
+ */
204
+ export function assertSqlIdentifier(name, what) {
205
+ if (!SQL_IDENTIFIER.test(name)) {
206
+ throw new Error(`refusing this dump: ${what} ${JSON.stringify(name)} is not a plain SQL identifier ` +
207
+ '(letters, digits and underscore, not starting with a digit). A scope dump whose ' +
208
+ 'names do not read like table names is corrupt or crafted — it is not loaded.');
209
+ }
210
+ return name;
211
+ }
212
+ /** Every table and column name in a dump, checked before any of them reaches SQL. */
213
+ export function assertDumpIdentifiers(tables) {
214
+ const seen = new Set();
215
+ for (const t of tables) {
216
+ assertSqlIdentifier(t.name, 'table name');
217
+ // A dump lists each table once. A REPEATED name is how a crafted one hides: the
218
+ // honest entry creates the table, and a second entry under the same name carries
219
+ // the payload while every per-entry check still sees a table that exists.
220
+ // Compared case-insensitively, because SQLite resolves table names that way —
221
+ // `Users` and `users` are one table, so two entries would otherwise merge into
222
+ // it. `sqlIdentifier` has already limited the name to ASCII, so lowercasing is
223
+ // the same fold SQLite applies rather than an approximation of it.
224
+ const key = t.name.toLowerCase();
225
+ if (seen.has(key)) {
226
+ throw new Error(`refusing this dump: table ${JSON.stringify(t.name)} is listed twice (SQLite resolves table ` +
227
+ 'names case-insensitively, so names differing only in case are one table). A scope dump names ' +
228
+ 'each of its tables once — a repeat is corrupt or crafted, and it is not loaded.');
229
+ }
230
+ seen.add(key);
231
+ for (const c of t.columns ?? []) {
232
+ assertSqlIdentifier(c, `column name in table ${JSON.stringify(t.name)}`);
233
+ }
234
+ }
235
+ }
236
+ const CREATE_TABLE_HEAD = /^\s*CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(?:"([^"]+)"|`([^`]+)`|\[([^\]]+)\]|([A-Za-z_][A-Za-z0-9_]*))\s*\(/i;
237
+ /**
238
+ * Is there a SECOND statement in this text?
239
+ *
240
+ * A small SQL-aware scan rather than a `split(';')`: a `;` inside a string literal,
241
+ * a quoted identifier or a comment is not a statement boundary, and treating one as
242
+ * such would refuse honest schemas (a DEFAULT of `'a;b'` is legal). Only a top-level
243
+ * `;` with something other than whitespace or comments after it counts.
244
+ *
245
+ * A table's DDL is a single `CREATE TABLE`, so there is deliberately no `BEGIN … END`
246
+ * handling here — that belongs to triggers, which a dump's `ddl` field never carries.
247
+ */
248
+ function hasTrailingStatement(sql) {
249
+ const n = sql.length;
250
+ let i = 0;
251
+ let ended = false;
252
+ while (i < n) {
253
+ const c = sql[i];
254
+ const c2 = sql[i + 1];
255
+ if (c === '-' && c2 === '-') {
256
+ while (i < n && sql[i] !== '\n')
257
+ i += 1;
258
+ continue;
259
+ }
260
+ if (c === '/' && c2 === '*') {
261
+ i += 2;
262
+ while (i < n && !(sql[i] === '*' && sql[i + 1] === '/'))
263
+ i += 1;
264
+ i += 2;
265
+ continue;
266
+ }
267
+ // A string literal, or a quoted identifier. The closing mark doubles to escape
268
+ // itself in all three of SQLite's quoting styles.
269
+ if (c === "'" || c === '"' || c === '`') {
270
+ i += 1;
271
+ while (i < n) {
272
+ if (sql[i] === c) {
273
+ if (sql[i + 1] === c) {
274
+ i += 2;
275
+ continue;
276
+ }
277
+ i += 1;
278
+ break;
279
+ }
280
+ i += 1;
281
+ }
282
+ continue;
283
+ }
284
+ if (c === '[') {
285
+ while (i < n && sql[i] !== ']')
286
+ i += 1;
287
+ i += 1;
288
+ continue;
289
+ }
290
+ if (c === ';') {
291
+ ended = true;
292
+ i += 1;
293
+ continue;
294
+ }
295
+ // Anything that is not whitespace, after a top-level `;`, is a second statement.
296
+ if (ended && !/\s/.test(c))
297
+ return true;
298
+ i += 1;
299
+ }
300
+ return false;
301
+ }
302
+ /**
303
+ * A dumped table's schema is exactly one `CREATE TABLE` for the name the dump
304
+ * declared — checked BEFORE it runs, because a check that runs afterwards has
305
+ * already let the statement happen.
306
+ *
307
+ * Both halves are load-bearing, and the second is the one that is easy to miss.
308
+ * Executing a table's `ddl` runs EVERY statement the text contains — `db.exec` on
309
+ * better-sqlite3 and `SqlStorage.exec` on a Durable Object both do — so
310
+ * `CREATE TABLE x (id TEXT); ATTACH DATABASE '/tmp/out' AS e;` executed both halves
311
+ * with two entirely plain identifiers, and nothing an identifier check adds would
312
+ * have caught it. Pinning the head alone is not enough either: a trailing statement
313
+ * rides in behind a perfectly honest `CREATE TABLE`.
314
+ *
315
+ * Refusing beats relying on the driver to compile only the first statement. That is
316
+ * true of better-sqlite3's `prepare` and NOT true of a Durable Object, which has no
317
+ * prepare step at all — so a rule that leaned on it would hold in the CLI and quietly
318
+ * fail on the hosted path, which is the one that matters most.
319
+ */
320
+ export function assertSingleCreateTable(ddl, name) {
321
+ const head = CREATE_TABLE_HEAD.exec(ddl);
322
+ const creates = head ? (head[1] ?? head[2] ?? head[3] ?? head[4]) : undefined;
323
+ if (creates !== name) {
324
+ throw new Error(`refusing this dump: the schema given for table ${JSON.stringify(name)} does not begin with ` +
325
+ `\`CREATE TABLE ${name} (\` — it begins ${JSON.stringify(ddl.slice(0, 60))}. A scope dump's schema ` +
326
+ 'and its own table list have to agree; one that does not is corrupt or crafted, and it is not loaded.');
327
+ }
328
+ if (hasTrailingStatement(ddl)) {
329
+ throw new Error(`refusing this dump: the schema given for table ${JSON.stringify(name)} carries more than one ` +
330
+ 'statement. A dumped table is one `CREATE TABLE`; anything appended to it would execute with ' +
331
+ 'the same privileges as the restore, so the dump is not loaded.');
332
+ }
333
+ }
334
+ /**
335
+ * Everything a dump must satisfy before any of it reaches SQL: its identifiers, and
336
+ * one `CREATE TABLE` per table. The single entry point a replay site calls, so a new
337
+ * one cannot pick up half the rules.
338
+ */
339
+ export function assertReplayableDump(tables) {
340
+ assertDumpIdentifiers(tables);
341
+ for (const t of tables)
342
+ assertSingleCreateTable(t.ddl, t.name);
343
+ }
175
344
  //# sourceMappingURL=introspection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"introspection.js","sourceRoot":"","sources":["../src/introspection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AAEH;;;;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M,UAAU,oBAAoB,CAAC,MAA2D;IAC9F,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,MAAM;QAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@substrat-run/contracts",
3
- "version": "0.95.0",
3
+ "version": "0.95.1",
4
4
  "description": "Substrat kernel contract schemas — Zod is the source of truth (master plan D-22); OAS/JSON Schema are emitted artifacts",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {