@shellui/core 0.7.0-alpha.6 → 0.7.0-alpha.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shellui/core",
|
|
3
|
-
"version": "0.7.0-alpha.
|
|
3
|
+
"version": "0.7.0-alpha.7",
|
|
4
4
|
"description": "Shellui Core - Core React application runtime",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"workbox-routing": "^7.4.0",
|
|
74
74
|
"workbox-strategies": "^7.4.0",
|
|
75
75
|
"workbox-window": "^7.4.0",
|
|
76
|
-
"@shellui/sdk": "0.7.0-alpha.
|
|
76
|
+
"@shellui/sdk": "0.7.0-alpha.7"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -362,7 +362,7 @@
|
|
|
362
362
|
"items": {
|
|
363
363
|
"type": "string"
|
|
364
364
|
},
|
|
365
|
-
"description": "Exact origins of service URLs (email, storage, hosting) a host may pass to a child with `ShelluiFrame` or `createAppFrame`, such as `https://storage.eu.shellui.com`. No wildcards. A URL outside this list, or a missing one, reaches the child as `null`. Omit to send children no service URLs."
|
|
365
|
+
"description": "Exact origins of service URLs (email, storage, files, hosting) a host may pass to a child with `ShelluiFrame` or `createAppFrame`, such as `https://storage.eu.shellui.com`. No wildcards. A URL outside this list, or a missing one, reaches the child as `null`. Omit to send children no service URLs."
|
|
366
366
|
}
|
|
367
367
|
},
|
|
368
368
|
"required": ["origins"],
|
|
@@ -185,6 +185,7 @@ describe('child frame service URLs', () => {
|
|
|
185
185
|
serviceOrigins: [
|
|
186
186
|
'https://email.eu.example.com',
|
|
187
187
|
'https://storage.eu.example.com',
|
|
188
|
+
'https://files.example.com',
|
|
188
189
|
'https://*.example.com',
|
|
189
190
|
'*',
|
|
190
191
|
],
|
|
@@ -210,6 +211,7 @@ describe('child frame service URLs', () => {
|
|
|
210
211
|
expect(result.entry.services).toEqual({
|
|
211
212
|
email: 'https://email.eu.example.com',
|
|
212
213
|
storage: 'https://storage.eu.example.com',
|
|
214
|
+
files: null,
|
|
213
215
|
hosting: null,
|
|
214
216
|
});
|
|
215
217
|
expect(result.entry.rejectedServices).toEqual([]);
|
|
@@ -230,10 +232,60 @@ describe('child frame service URLs', () => {
|
|
|
230
232
|
});
|
|
231
233
|
expect(result.ok).toBe(true);
|
|
232
234
|
if (!result.ok) return;
|
|
233
|
-
expect(result.entry.services).toEqual({
|
|
235
|
+
expect(result.entry.services).toEqual({
|
|
236
|
+
email: null,
|
|
237
|
+
storage: null,
|
|
238
|
+
files: null,
|
|
239
|
+
hosting: null,
|
|
240
|
+
});
|
|
234
241
|
expect(result.entry.rejectedServices).toEqual(['storage', 'hosting']);
|
|
235
242
|
});
|
|
236
243
|
|
|
244
|
+
it('forwards an allowed files URL as storage.filesUrl', () => {
|
|
245
|
+
const result = register({
|
|
246
|
+
storage: 'https://storage.eu.example.com',
|
|
247
|
+
files: 'https://files.example.com/',
|
|
248
|
+
});
|
|
249
|
+
expect(result.ok).toBe(true);
|
|
250
|
+
if (!result.ok) return;
|
|
251
|
+
expect(result.entry.services.files).toBe('https://files.example.com');
|
|
252
|
+
const options = childFrameAuthPropagationOptions({
|
|
253
|
+
identity: result.entry.identity,
|
|
254
|
+
getAppSession: () => null,
|
|
255
|
+
services: result.entry.services,
|
|
256
|
+
});
|
|
257
|
+
expect(options.storage).toEqual({
|
|
258
|
+
url: 'https://storage.eu.example.com',
|
|
259
|
+
filesUrl: 'https://files.example.com',
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('drops a files URL whose origin is not allowed, or without storage', () => {
|
|
264
|
+
const rejected = register({
|
|
265
|
+
storage: 'https://storage.eu.example.com',
|
|
266
|
+
files: 'https://files.evil.example.org',
|
|
267
|
+
});
|
|
268
|
+
expect(rejected.ok).toBe(true);
|
|
269
|
+
if (!rejected.ok) return;
|
|
270
|
+
expect(rejected.entry.rejectedServices).toEqual(['files']);
|
|
271
|
+
expect(
|
|
272
|
+
childFrameAuthPropagationOptions({
|
|
273
|
+
identity: null,
|
|
274
|
+
getAppSession: () => null,
|
|
275
|
+
services: rejected.entry.services,
|
|
276
|
+
}).storage,
|
|
277
|
+
).toEqual({ url: 'https://storage.eu.example.com' });
|
|
278
|
+
const alone = register({ files: 'https://files.example.com' });
|
|
279
|
+
if (!alone.ok) throw new Error('expected ok');
|
|
280
|
+
expect(
|
|
281
|
+
childFrameAuthPropagationOptions({
|
|
282
|
+
identity: null,
|
|
283
|
+
getAppSession: () => null,
|
|
284
|
+
services: alone.entry.services,
|
|
285
|
+
}).storage,
|
|
286
|
+
).toBeNull();
|
|
287
|
+
});
|
|
288
|
+
|
|
237
289
|
it('never matches a wildcard entry', () => {
|
|
238
290
|
const result = register({ hosting: 'https://hosting.example.com' });
|
|
239
291
|
expect(result.ok).toBe(true);
|
|
@@ -252,7 +304,12 @@ describe('child frame service URLs', () => {
|
|
|
252
304
|
const result = register(undefined, shellWithServices);
|
|
253
305
|
expect(result.ok).toBe(true);
|
|
254
306
|
if (!result.ok) return;
|
|
255
|
-
expect(result.entry.services).toEqual({
|
|
307
|
+
expect(result.entry.services).toEqual({
|
|
308
|
+
email: null,
|
|
309
|
+
storage: null,
|
|
310
|
+
files: null,
|
|
311
|
+
hosting: null,
|
|
312
|
+
});
|
|
256
313
|
const options = childFrameAuthPropagationOptions({
|
|
257
314
|
identity: result.entry.identity,
|
|
258
315
|
getAppSession: () => null,
|
|
@@ -17,9 +17,9 @@ export type ChildFrameEntry = {
|
|
|
17
17
|
rejectedServices: ChildFrameServiceKey[];
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export type ChildFrameServiceKey = 'email' | 'storage' | 'hosting';
|
|
20
|
+
export type ChildFrameServiceKey = 'email' | 'storage' | 'files' | 'hosting';
|
|
21
21
|
export type ChildFrameServices = Record<ChildFrameServiceKey, string | null>;
|
|
22
|
-
const SERVICE_KEYS: readonly ChildFrameServiceKey[] = ['email', 'storage', 'hosting'];
|
|
22
|
+
const SERVICE_KEYS: readonly ChildFrameServiceKey[] = ['email', 'storage', 'files', 'hosting'];
|
|
23
23
|
|
|
24
24
|
export type ChildFrameRegistration =
|
|
25
25
|
| { ok: true; entry: ChildFrameEntry }
|
|
@@ -64,7 +64,7 @@ export function resolveChildFrameServices(
|
|
|
64
64
|
): { services: ChildFrameServices; rejected: ChildFrameServiceKey[] } {
|
|
65
65
|
const allowed = originList(allowedOrigins);
|
|
66
66
|
const raw = (input && typeof input === 'object' ? input : {}) as Record<string, unknown>;
|
|
67
|
-
const services: ChildFrameServices = { email: null, storage: null, hosting: null };
|
|
67
|
+
const services: ChildFrameServices = { email: null, storage: null, files: null, hosting: null };
|
|
68
68
|
const rejected: ChildFrameServiceKey[] = [];
|
|
69
69
|
for (const key of SERVICE_KEYS) {
|
|
70
70
|
const value = raw[key];
|
|
@@ -180,7 +180,7 @@ export function frameAuthPropagationOptions(input: {
|
|
|
180
180
|
export function childFrameAuthPropagationOptions(input: {
|
|
181
181
|
identity: ResolvedAppBackend | null;
|
|
182
182
|
getAppSession: (key: string) => AuthSession | null;
|
|
183
|
-
services?: Partial<Record<'email' | 'storage' | 'hosting', string | null>> | null;
|
|
183
|
+
services?: Partial<Record<'email' | 'storage' | 'files' | 'hosting', string | null>> | null;
|
|
184
184
|
}): FrameAuthPropagationOptions {
|
|
185
185
|
const { identity, getAppSession } = input;
|
|
186
186
|
const allowed = input.services ?? {};
|
|
@@ -194,7 +194,10 @@ export function childFrameAuthPropagationOptions(input: {
|
|
|
194
194
|
settingsUser: settingsUserFromSession(session),
|
|
195
195
|
services: {
|
|
196
196
|
email: allowed.email ? { url: allowed.email } : null,
|
|
197
|
-
|
|
197
|
+
// The files app URL rides on storage and is dropped when storage is not allowed.
|
|
198
|
+
storage: allowed.storage
|
|
199
|
+
? { url: allowed.storage, ...(allowed.files ? { filesUrl: allowed.files } : {}) }
|
|
200
|
+
: null,
|
|
198
201
|
hosting: allowed.hosting ? { url: allowed.hosting } : null,
|
|
199
202
|
},
|
|
200
203
|
});
|