deepspace 0.9.0 → 0.9.2
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.
- package/CHANGELOG.md +34 -0
- package/README.md +24 -11
- package/dist/cli.js +632 -307
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/dist/server.js +54 -12
- package/dist/server.js.map +1 -1
- package/dist/worker.d.ts +13 -1
- package/dist/worker.js +85 -12
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1863,9 +1863,12 @@ function lintSchema(schema) {
|
|
|
1863
1863
|
}
|
|
1864
1864
|
if (schema.ownerField) {
|
|
1865
1865
|
const col = schema.columns.find((c) => c.name === schema.ownerField);
|
|
1866
|
-
|
|
1866
|
+
const spoofableRoles = Object.entries(schema.permissions).filter(
|
|
1867
|
+
([role, permissions]) => role !== "owner" && role !== "admin" && permissions.create === true
|
|
1868
|
+
).map(([role]) => role);
|
|
1869
|
+
if (col && !col.userBound && spoofableRoles.length > 0) {
|
|
1867
1870
|
warnings.push(
|
|
1868
|
-
`[${schema.name}] ownerField is '${schema.ownerField}' but that column is not marked userBound: true.
|
|
1871
|
+
`[${schema.name}] ownerField is '${schema.ownerField}' but that column is not marked userBound: true. Client role(s) ${spoofableRoles.join(", ")} can create a row with someone else's id in this field, bypassing 'own' permission checks. Add userBound: true (and ideally immutable: true) to the column.`
|
|
1869
1872
|
);
|
|
1870
1873
|
}
|
|
1871
1874
|
}
|
|
@@ -6314,8 +6317,18 @@ var CHANNELS_SCHEMA = {
|
|
|
6314
6317
|
columns: [
|
|
6315
6318
|
{ name: "name", storage: "text", interpretation: "plain" },
|
|
6316
6319
|
{ name: "description", storage: "text", interpretation: "plain" },
|
|
6317
|
-
{
|
|
6318
|
-
|
|
6320
|
+
{
|
|
6321
|
+
name: "type",
|
|
6322
|
+
storage: "text",
|
|
6323
|
+
interpretation: { kind: "select", options: ["public", "private", "dm"] }
|
|
6324
|
+
},
|
|
6325
|
+
{
|
|
6326
|
+
name: "createdBy",
|
|
6327
|
+
storage: "text",
|
|
6328
|
+
interpretation: "plain",
|
|
6329
|
+
userBound: true,
|
|
6330
|
+
immutable: true
|
|
6331
|
+
},
|
|
6319
6332
|
{ name: "archived", storage: "number", interpretation: { kind: "boolean" } }
|
|
6320
6333
|
],
|
|
6321
6334
|
ownerField: "createdBy",
|
|
@@ -6330,7 +6343,13 @@ var MESSAGES_SCHEMA = {
|
|
|
6330
6343
|
columns: [
|
|
6331
6344
|
{ name: "channelId", storage: "text", interpretation: "plain" },
|
|
6332
6345
|
{ name: "content", storage: "text", interpretation: "plain" },
|
|
6333
|
-
{
|
|
6346
|
+
{
|
|
6347
|
+
name: "authorId",
|
|
6348
|
+
storage: "text",
|
|
6349
|
+
interpretation: "plain",
|
|
6350
|
+
userBound: true,
|
|
6351
|
+
immutable: true
|
|
6352
|
+
},
|
|
6334
6353
|
{ name: "parentMessageId", storage: "text", interpretation: "plain" },
|
|
6335
6354
|
{ name: "edited", storage: "number", interpretation: { kind: "boolean" } },
|
|
6336
6355
|
{ name: "editedAt", storage: "text", interpretation: { kind: "datetime" } },
|
|
@@ -6352,7 +6371,7 @@ var REACTIONS_SCHEMA = {
|
|
|
6352
6371
|
{ name: "messageId", storage: "text", interpretation: "plain" },
|
|
6353
6372
|
{ name: "channelId", storage: "text", interpretation: "plain" },
|
|
6354
6373
|
{ name: "emoji", storage: "text", interpretation: "plain" },
|
|
6355
|
-
{ name: "userId", storage: "text", interpretation: "plain" }
|
|
6374
|
+
{ name: "userId", storage: "text", interpretation: "plain", userBound: true, immutable: true }
|
|
6356
6375
|
],
|
|
6357
6376
|
ownerField: "userId",
|
|
6358
6377
|
uniqueOn: ["messageId", "emoji", "userId"],
|
|
@@ -6366,7 +6385,7 @@ var CHANNEL_MEMBERS_SCHEMA = {
|
|
|
6366
6385
|
name: "channel-members",
|
|
6367
6386
|
columns: [
|
|
6368
6387
|
{ name: "channelId", storage: "text", interpretation: "plain" },
|
|
6369
|
-
{ name: "userId", storage: "text", interpretation: "plain" },
|
|
6388
|
+
{ name: "userId", storage: "text", interpretation: "plain", userBound: true, immutable: true },
|
|
6370
6389
|
{ name: "joinedAt", storage: "text", interpretation: { kind: "datetime" } }
|
|
6371
6390
|
],
|
|
6372
6391
|
ownerField: "userId",
|
|
@@ -6380,10 +6399,33 @@ var CHANNEL_MEMBERS_SCHEMA = {
|
|
|
6380
6399
|
var CHANNEL_INVITATIONS_SCHEMA = {
|
|
6381
6400
|
name: "channel-invitations",
|
|
6382
6401
|
columns: [
|
|
6383
|
-
{
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6402
|
+
{
|
|
6403
|
+
name: "channelId",
|
|
6404
|
+
storage: "text",
|
|
6405
|
+
interpretation: "plain",
|
|
6406
|
+
required: true,
|
|
6407
|
+
immutable: true
|
|
6408
|
+
},
|
|
6409
|
+
{
|
|
6410
|
+
name: "invitedUserId",
|
|
6411
|
+
storage: "text",
|
|
6412
|
+
interpretation: "plain",
|
|
6413
|
+
required: true,
|
|
6414
|
+
immutable: true
|
|
6415
|
+
},
|
|
6416
|
+
{
|
|
6417
|
+
name: "invitedBy",
|
|
6418
|
+
storage: "text",
|
|
6419
|
+
interpretation: "plain",
|
|
6420
|
+
userBound: true,
|
|
6421
|
+
immutable: true
|
|
6422
|
+
},
|
|
6423
|
+
{
|
|
6424
|
+
name: "status",
|
|
6425
|
+
storage: "text",
|
|
6426
|
+
interpretation: { kind: "select", options: ["pending", "accepted", "declined"] },
|
|
6427
|
+
required: true
|
|
6428
|
+
}
|
|
6387
6429
|
],
|
|
6388
6430
|
uniqueOn: ["channelId", "invitedUserId"],
|
|
6389
6431
|
permissions: {
|
|
@@ -6396,7 +6438,7 @@ var READ_RECEIPTS_SCHEMA = {
|
|
|
6396
6438
|
name: "read-receipts",
|
|
6397
6439
|
columns: [
|
|
6398
6440
|
{ name: "channelId", storage: "text", interpretation: "plain" },
|
|
6399
|
-
{ name: "userId", storage: "text", interpretation: "plain" },
|
|
6441
|
+
{ name: "userId", storage: "text", interpretation: "plain", userBound: true, immutable: true },
|
|
6400
6442
|
{ name: "lastReadAt", storage: "text", interpretation: { kind: "datetime" } }
|
|
6401
6443
|
],
|
|
6402
6444
|
ownerField: "userId",
|