@volter/world-runtime 2.0.33 → 2.0.34
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/dist/src/served-world.js +9 -0
- package/package.json +1 -1
- package/src/served-world.ts +8 -0
package/dist/src/served-world.js
CHANGED
|
@@ -1189,6 +1189,15 @@ export class WorldDoors {
|
|
|
1189
1189
|
}
|
|
1190
1190
|
if (kind === 'links' && !name && request.method === 'GET')
|
|
1191
1191
|
return Response.json({ links: this.links() });
|
|
1192
|
+
// OPENING A SEAL — pointing this World at a vendor (a link, a twin's root) or sealing the credential it uses there — is
|
|
1193
|
+
// the World token's act, or a person's at its page: never a key's, which an app or a script holds (an app that could
|
|
1194
|
+
// open its own seal would be unsealed by itself, not deliberately)
|
|
1195
|
+
const opensSeal = (kind === 'links' && name && (request.method === 'PUT' || request.method === 'DELETE'))
|
|
1196
|
+
|| (kind === 'twins' && name && (verb === 'root' || verb === 'credential') && request.method === 'PUT')
|
|
1197
|
+
// a check runs in a local World's own process, with all it can reach: putting or removing one is the same act
|
|
1198
|
+
|| (kind === 'checks' && name && (request.method === 'PUT' || request.method === 'DELETE'));
|
|
1199
|
+
if (opensSeal && via === 'key')
|
|
1200
|
+
return Response.json({ error: 'opening a seal is the World\'s token\'s act, or a person\'s at its page: a key cannot point this World at a vendor, seal a credential, or change its checks' }, { status: 403 });
|
|
1192
1201
|
if (kind === 'links' && name && request.method === 'PUT') {
|
|
1193
1202
|
if (!/^[a-z0-9][a-z0-9_-]{0,63}$/.test(name) || this.up().services[name])
|
|
1194
1203
|
return Response.json({ error: 'a link is named [a-z0-9_-] and is not a twin of this World' }, { status: 400 });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/world-runtime",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.34",
|
|
4
4
|
"description": "World configs for twins: boot named local runtimes, allocate ports, generate world.env/instance.json, and run apps against fake-key twin worlds.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"twin",
|
package/src/served-world.ts
CHANGED
|
@@ -1037,6 +1037,14 @@ export class WorldDoors {
|
|
|
1037
1037
|
return Response.json(approveWorldChangeset(name, { root: this.worldRoot, world: this.name, principal, ...(body.note ? { note: body.note } : {}) }));
|
|
1038
1038
|
}
|
|
1039
1039
|
if (kind === 'links' && !name && request.method === 'GET') return Response.json({ links: this.links() });
|
|
1040
|
+
// OPENING A SEAL — pointing this World at a vendor (a link, a twin's root) or sealing the credential it uses there — is
|
|
1041
|
+
// the World token's act, or a person's at its page: never a key's, which an app or a script holds (an app that could
|
|
1042
|
+
// open its own seal would be unsealed by itself, not deliberately)
|
|
1043
|
+
const opensSeal = (kind === 'links' && name && (request.method === 'PUT' || request.method === 'DELETE'))
|
|
1044
|
+
|| (kind === 'twins' && name && (verb === 'root' || verb === 'credential') && request.method === 'PUT')
|
|
1045
|
+
// a check runs in a local World's own process, with all it can reach: putting or removing one is the same act
|
|
1046
|
+
|| (kind === 'checks' && name && (request.method === 'PUT' || request.method === 'DELETE'));
|
|
1047
|
+
if (opensSeal && via === 'key') return Response.json({ error: 'opening a seal is the World\'s token\'s act, or a person\'s at its page: a key cannot point this World at a vendor, seal a credential, or change its checks' }, { status: 403 });
|
|
1040
1048
|
if (kind === 'links' && name && request.method === 'PUT') {
|
|
1041
1049
|
if (!/^[a-z0-9][a-z0-9_-]{0,63}$/.test(name) || this.up().services[name]) return Response.json({ error: 'a link is named [a-z0-9_-] and is not a twin of this World' }, { status: 400 });
|
|
1042
1050
|
const body = (await request.json()) as { origin?: string };
|