aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-client
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-client')
-rw-r--r--packages/meshbay-client/src/main.js11
-rw-r--r--packages/meshbay-client/src/transcripts.js17
2 files changed, 26 insertions, 2 deletions
diff --git a/packages/meshbay-client/src/main.js b/packages/meshbay-client/src/main.js
index cbaabc4..0020084 100644
--- a/packages/meshbay-client/src/main.js
+++ b/packages/meshbay-client/src/main.js
@@ -2218,7 +2218,16 @@ function registerBridge() {
await confirmFolder(body.path);
return ['POST', target, body];
},
- updateRoot: (a) => ['PATCH', root(a), anObject(a.updates)],
+ // Opening a folder to writes from every member is asked like sharing it;
+ // closing it, or the removable flag, only narrows.
+ updateRoot: async (a) => {
+ const updates = anObject(a.updates);
+ if (updates.writable === true) {
+ await confirmOrRefuse('native.root_writable_confirm',
+ { name: aText(a.rootName, 'the folder name') });
+ }
+ return ['PATCH', root(a), updates];
+ },
ejectRoot: (a) => ['PUT', `${root(a)}/eject`],
plugRoot: (a) => ['PUT', `${root(a)}/plug`],
removeRoot: (a) => ['DELETE', root(a)],
diff --git a/packages/meshbay-client/src/transcripts.js b/packages/meshbay-client/src/transcripts.js
index 0b6d0c0..63f87b2 100644
--- a/packages/meshbay-client/src/transcripts.js
+++ b/packages/meshbay-client/src/transcripts.js
@@ -30,6 +30,21 @@ function lenPrefixed(prefix, parts) {
return Buffer.concat(chunks);
}
+// The signed operations this application asks a node to perform
+// (meshbay_common/adminop.py). A list, not a pattern: what widens a node's
+// sharing — `root_add`, `root_update`, `group_attach`, gone from MNP 6.0 — is
+// never signed here, so a node older than that cannot be driven into it by a
+// script in the page either.
+const ADMIN_OPS = new Set([
+ 'file_delete', 'dir_delete', 'invite_create', 'invite_link_create',
+ 'invite_cancel', 'member_revoke', 'member_unpin', 'gek_rotate',
+ 'apps_enabled', 'set_scan_settings', 'transfer_limits', 'tmdb_config',
+ 'tmdb_enabled', 'tmdb_override', 'tmdb_rematch', 'musicbrainz_enabled',
+ 'root_remove', 'root_eject', 'root_plug', 'app_directories',
+ 'chat_directory', 'chat_link_preview', 'search_listed', 'chat_epoch',
+ 'group_detach',
+]);
+
// ── Field checks ──────────────────────────────────────────────────────────
//
// Shapes, not trust: what is checked here is that a field is what its name
@@ -143,7 +158,7 @@ function transcriptFor(kind, f, ctx) {
}
case 'admin': {
const op = String(fields.op ?? '');
- if (!/^[a-z_]{1,32}$/.test(op)) refuse('not an operation');
+ if (!ADMIN_OPS.has(op)) refuse('not an operation');
return lenPrefixed(PREFIX.admin, [
enc(op), enc(sameNode()), enc(groupId(fields.groupId)),
enc(text(fields.subject, 'the subject', 16384)),