@bstage-sdk/bridge 0.17.1 → 0.18.0
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/README.md +13 -4
- package/dist/{chunk-LGCWV4TV.js → chunk-PIBPZZGO.js} +29 -9
- package/dist/{createSrcdoc-DYZk6dDJ.d.cts → createSrcdoc-BT92gCXB.d.cts} +25 -6
- package/dist/{createSrcdoc-DYZk6dDJ.d.ts → createSrcdoc-BT92gCXB.d.ts} +25 -6
- package/dist/frame.d.cts +1 -1
- package/dist/frame.d.ts +1 -1
- package/dist/host.cjs +28 -9
- package/dist/host.d.cts +4 -4
- package/dist/host.d.ts +4 -4
- package/dist/host.js +1 -1
- package/dist/index.cjs +30 -9
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/{messages-pMXAlatW.d.ts → messages-B4TTkSkI.d.cts} +1 -1
- package/dist/{messages-pMXAlatW.d.cts → messages-B4TTkSkI.d.ts} +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -70,6 +70,8 @@ iframe.srcdoc = createSrcdoc({
|
|
|
70
70
|
elementName,
|
|
71
71
|
title: placementName,
|
|
72
72
|
mediaOrigins, // 선택: 템플릿이 이미지·미디어를 불러올 정확한 https origin(최대 20개)
|
|
73
|
+
imagesAnyHttps, // 선택: true면 img-src에 https: — 모든 https 이미지(기본 false)
|
|
74
|
+
frameOrigins, // 선택: 템플릿이 <iframe>으로 임베드할 정확한 https origin(최대 10개, 기본 frame-src 'none')
|
|
73
75
|
})
|
|
74
76
|
container.appendChild(iframe)
|
|
75
77
|
|
|
@@ -218,7 +220,7 @@ external에 인증을 붙이는 fetch를 주입하지 않습니다. 외부 갈
|
|
|
218
220
|
| `navigate` | `{ path, replace?, reload? }` | `/`로 시작, `//`·`/\`·공백·제어문자 거절. 옵션은 boolean만 |
|
|
219
221
|
| `back` | `{}` | |
|
|
220
222
|
| `openExternal` | `{ url }` | https만. 처리기가 없으면 `noopener,noreferrer`로 새 창 |
|
|
221
|
-
| `navigateExternal` | `{ url }` | 같은 탭 외부 이동. https만(userinfo 거절). 처리기 `navigateExternal`이
|
|
223
|
+
| `navigateExternal` | `{ url }` | 같은 탭 외부 이동. https만(userinfo 거절). 처리기 `navigateExternal`이 이동 여부를 정한다. 처리기가 없으면 `UNSUPPORTED`(새 창으로 대신하지 않음). 프레임당 분당 3회(넘으면 `RATE_LIMITED`) |
|
|
222
224
|
| `toast` | `{ message, kind? }` | 500자에서 자름 |
|
|
223
225
|
| `resize` | `{ height }` | 0~200000px, rAF 디바운스 |
|
|
224
226
|
| `track` | `{ name, params? }` | 이름 100자, params 직렬화 4KB |
|
|
@@ -264,7 +266,8 @@ external에 인증을 붙이는 fetch를 주입하지 않습니다. 외부 갈
|
|
|
264
266
|
프레임 안에서 `window.open`은 sandbox(`allow-popups` 없음) 때문에 아무 일도 하지 않고, `location.assign`으로 직접 나가면
|
|
265
267
|
프레임 자기 내비게이션이 되어 세션이 끊기고(위 "세션 수명") 콘솔 격리 검사에도 걸립니다. 그래서 같은 탭 외부 이동은
|
|
266
268
|
호스트에 요청합니다. 호스트는 `validateExternalUrl`(https만, userinfo 거절)로 검증한 href를 `handlers.navigateExternal`로
|
|
267
|
-
넘기고,
|
|
269
|
+
넘기고, 이동 여부는 처리기가 정합니다(확인 창을 띄우거나 바로 이동). b.stage 웹은 확인 창 없이 바로 이동하되, 사용자 활성화
|
|
270
|
+
(`navigator.userActivation.isActive`)가 없으면 무시합니다. 처리기가 없으면 `UNSUPPORTED`입니다 — `openExternal`과
|
|
268
271
|
달리 기본 동작(새 창)으로 대신하지 않습니다.
|
|
269
272
|
|
|
270
273
|
### 계정 세션 (`session`·`otp`)
|
|
@@ -331,10 +334,10 @@ external에 인증을 붙이는 fetch를 주입하지 않습니다. 외부 갈
|
|
|
331
334
|
default-src 'none'
|
|
332
335
|
script-src 'nonce-…' {assetOrigin}
|
|
333
336
|
style-src 'unsafe-inline' {assetOrigin}
|
|
334
|
-
img-src {assetOrigin} {mediaOrigins…} data: blob:
|
|
337
|
+
img-src {assetOrigin} {mediaOrigins…} [https:] data: blob:
|
|
335
338
|
font-src {assetOrigin} data:
|
|
336
339
|
media-src {assetOrigin} {mediaOrigins…} blob:
|
|
337
|
-
connect-src https: wss:; frame-src 'none'; form-action 'none'; base-uri 'none'
|
|
340
|
+
connect-src https: wss:; frame-src {frameOrigins… | 'none'}; form-action 'none'; base-uri 'none'
|
|
338
341
|
```
|
|
339
342
|
|
|
340
343
|
- `connect-src`는 항상 `https: wss:`다(아래 "프레임 네트워크"). 평문 `http:`·`ws:`는 열지 않습니다. 토큰이 필요한 API는
|
|
@@ -343,6 +346,12 @@ connect-src https: wss:; frame-src 'none'; form-action 'none'; base-uri 'none'
|
|
|
343
346
|
- img-src·media-src에 맨 `https:`는 두지 않습니다 — 두면 `<img src="https://임의-origin/?d=…">`가 자유로운 GET
|
|
344
347
|
유출 통로가 됩니다. 외부 이미지·미디어가 필요하면 `mediaOrigins`에 **정확한 https origin**만 넘깁니다
|
|
345
348
|
(경로·쿼리·userinfo·와일드카드·대문자 호스트 불가, 최대 20개, 하나라도 틀리면 `TypeError`). font-src는 넓히지 않습니다.
|
|
349
|
+
- 외부 썸네일처럼 출처가 정해지지 않은 이미지가 필요하면 `imagesAnyHttps: true`로 img-src에만 `https:`를 더합니다.
|
|
350
|
+
`connect-src`가 이미 `https:`라 프레임이 임의 https에 요청할 수 있으므로 이 옵션으로 유출 경로가 늘지는 않습니다.
|
|
351
|
+
media-src·font-src는 그대로입니다. b.stage 웹은 켭니다.
|
|
352
|
+
- 임베드는 `frameOrigins`에 **정확한 https origin**만 넘깁니다(검증 규칙은 `mediaOrigins`와 같고 최대 10개). 기본은
|
|
353
|
+
`frame-src 'none'`입니다. 임베드 프레임은 격리 프레임의 sandbox(`allow-scripts`, `allow-same-origin` 없음)를 물려받아
|
|
354
|
+
출처·저장소가 필요한 플레이어는 동작하지 않습니다 — Spotify 임베드는 동작하고 YouTube 플레이어는 빈 화면입니다(2026-11 실측).
|
|
346
355
|
- **CSP는 심층 방어이지 경계가 아닙니다.** 프레임은 자기 자신을 다른 URL로 이동(`location = …`)시킬 수 있고, 이 내비게이션은
|
|
347
356
|
CSP로 막히지 않으므로 URL에 실은 데이터는 여전히 밖으로 나갈 수 있습니다. 실제 경계는 **자격증명(토큰·쿠키)이 프레임에
|
|
348
357
|
절대 들어가지 않습니다**는 것입니다 — 인증은 호스트의 `fetchImpl`이 붙이고, 토큰을 응답으로 돌려주는 인증 경로는
|
|
@@ -1053,6 +1053,7 @@ function renderFrameCss() {
|
|
|
1053
1053
|
// src/srcdoc/createSrcdoc.ts
|
|
1054
1054
|
var FRAME_TOKEN_CSS = renderFrameCss();
|
|
1055
1055
|
var MAX_MEDIA_ORIGINS = 20;
|
|
1056
|
+
var MAX_FRAME_ORIGINS = 10;
|
|
1056
1057
|
var REPORT_FLUSH_DELAY_MS = 1e3;
|
|
1057
1058
|
var MAX_ELEMENT_NAME_LENGTH = 100;
|
|
1058
1059
|
var ELEMENT_NAME_RE = /^[a-z][a-z0-9._]*-[a-z0-9._-]*$/;
|
|
@@ -1076,34 +1077,50 @@ function assertEntryUrl(entryUrl, assetOrigin) {
|
|
|
1076
1077
|
}
|
|
1077
1078
|
return parsed.href;
|
|
1078
1079
|
}
|
|
1079
|
-
function
|
|
1080
|
+
function normalizeHttpsOrigins(label, value, max) {
|
|
1080
1081
|
if (value === void 0) return Object.freeze([]);
|
|
1081
1082
|
if (!Array.isArray(value)) {
|
|
1082
|
-
throw new TypeError(
|
|
1083
|
+
throw new TypeError(`[bstage-bridge] ${label}\uB294 \uBC30\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`);
|
|
1083
1084
|
}
|
|
1084
|
-
if (value.length >
|
|
1085
|
-
throw new TypeError(`[bstage-bridge]
|
|
1085
|
+
if (value.length > max) {
|
|
1086
|
+
throw new TypeError(`[bstage-bridge] ${label}\uB294 \uCD5C\uB300 ${max}\uAC1C\uC785\uB2C8\uB2E4`);
|
|
1086
1087
|
}
|
|
1087
1088
|
const origins = value.map((o) => {
|
|
1088
1089
|
const origin = normalizeExactOrigin(o, ["https:"]);
|
|
1089
1090
|
if (!origin) {
|
|
1090
|
-
throw new TypeError(
|
|
1091
|
+
throw new TypeError(`[bstage-bridge] ${label} \uD56D\uBAA9\uC740 \uC815\uD655\uD55C https origin\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`);
|
|
1091
1092
|
}
|
|
1092
1093
|
return origin;
|
|
1093
1094
|
});
|
|
1094
1095
|
return Object.freeze([...new Set(origins)]);
|
|
1095
1096
|
}
|
|
1096
|
-
function
|
|
1097
|
+
function normalizeMediaOrigins(value) {
|
|
1098
|
+
return normalizeHttpsOrigins("mediaOrigins", value, MAX_MEDIA_ORIGINS);
|
|
1099
|
+
}
|
|
1100
|
+
function normalizeFrameOrigins(value) {
|
|
1101
|
+
return normalizeHttpsOrigins("frameOrigins", value, MAX_FRAME_ORIGINS);
|
|
1102
|
+
}
|
|
1103
|
+
function normalizeImagesAnyHttps(value) {
|
|
1104
|
+
if (value === void 0) return false;
|
|
1105
|
+
if (typeof value !== "boolean") {
|
|
1106
|
+
throw new TypeError("[bstage-bridge] imagesAnyHttps\uB294 \uBD88\uB9AC\uC5B8\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4");
|
|
1107
|
+
}
|
|
1108
|
+
return value;
|
|
1109
|
+
}
|
|
1110
|
+
function buildFrameCsp(nonce, assetOrigin, mediaOrigins = [], options = {}) {
|
|
1097
1111
|
const media = [assetOrigin, ...normalizeMediaOrigins(mediaOrigins)].join(" ");
|
|
1112
|
+
const images = normalizeImagesAnyHttps(options.imagesAnyHttps) ? `${media} https:` : media;
|
|
1113
|
+
const frames = normalizeFrameOrigins(options.frameOrigins);
|
|
1114
|
+
const frameSrc = frames.length > 0 ? frames.join(" ") : "'none'";
|
|
1098
1115
|
return [
|
|
1099
1116
|
"default-src 'none'",
|
|
1100
1117
|
`script-src 'nonce-${nonce}' ${assetOrigin}`,
|
|
1101
1118
|
`style-src 'unsafe-inline' ${assetOrigin}`,
|
|
1102
|
-
`img-src ${
|
|
1119
|
+
`img-src ${images} data: blob:`,
|
|
1103
1120
|
`font-src ${assetOrigin} data:`,
|
|
1104
1121
|
`media-src ${media} blob:`,
|
|
1105
1122
|
"connect-src https: wss:",
|
|
1106
|
-
|
|
1123
|
+
`frame-src ${frameSrc}`,
|
|
1107
1124
|
"form-action 'none'",
|
|
1108
1125
|
"base-uri 'none'"
|
|
1109
1126
|
].join("; ");
|
|
@@ -1187,11 +1204,13 @@ function createSrcdoc(options) {
|
|
|
1187
1204
|
}
|
|
1188
1205
|
if (typeof title !== "string") throw new TypeError("[bstage-bridge] title\uC740 \uBB38\uC790\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4");
|
|
1189
1206
|
const mediaOrigins = normalizeMediaOrigins(options.mediaOrigins);
|
|
1207
|
+
const imagesAnyHttps = normalizeImagesAnyHttps(options.imagesAnyHttps);
|
|
1208
|
+
const frameOrigins = normalizeFrameOrigins(options.frameOrigins);
|
|
1190
1209
|
const { crossOrigin } = options;
|
|
1191
1210
|
if (crossOrigin !== void 0 && crossOrigin !== "anonymous") {
|
|
1192
1211
|
throw new TypeError("[bstage-bridge] crossOrigin\uC740 'anonymous'\uB9CC \uBC1B\uC2B5\uB2C8\uB2E4");
|
|
1193
1212
|
}
|
|
1194
|
-
const csp = buildFrameCsp(nonce, assetOrigin, mediaOrigins);
|
|
1213
|
+
const csp = buildFrameCsp(nonce, assetOrigin, mediaOrigins, { imagesAnyHttps, frameOrigins });
|
|
1195
1214
|
const script = bootstrapScript({ session, hostOrigin, entryUrl, elementName, crossOrigin });
|
|
1196
1215
|
if (/<\/script|<!--/i.test(script)) {
|
|
1197
1216
|
throw new Error("[bstage-bridge] \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uC2A4\uD06C\uB9BD\uD2B8\uC5D0 \uC2A4\uD06C\uB9BD\uD2B8 \uC885\uB8CC \uC2DC\uD000\uC2A4\uAC00 \uC788\uC2B5\uB2C8\uB2E4");
|
|
@@ -1282,6 +1301,7 @@ export {
|
|
|
1282
1301
|
normalizePinnedHeaders,
|
|
1283
1302
|
prepareFetch,
|
|
1284
1303
|
MAX_MEDIA_ORIGINS,
|
|
1304
|
+
MAX_FRAME_ORIGINS,
|
|
1285
1305
|
REPORT_FLUSH_DELAY_MS,
|
|
1286
1306
|
MAX_ELEMENT_NAME_LENGTH,
|
|
1287
1307
|
buildFrameCsp,
|
|
@@ -25,6 +25,17 @@ interface CreateSrcdocOptions {
|
|
|
25
25
|
* CSP img-src·media-src에만 더해진다. 잘못된 항목이 하나라도 있으면 TypeError.
|
|
26
26
|
*/
|
|
27
27
|
readonly mediaOrigins?: readonly string[];
|
|
28
|
+
/**
|
|
29
|
+
* `true`면 CSP img-src에 `https:`를 더해 모든 https 이미지(외부 썸네일 등)를 연다. media-src·font-src는 그대로.
|
|
30
|
+
* 프레임은 이미 `connect-src https:`로 임의 https에 요청할 수 있으므로 새 유출 경로는 생기지 않는다. 기본 `false`.
|
|
31
|
+
*/
|
|
32
|
+
readonly imagesAnyHttps?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 템플릿이 `<iframe>`으로 임베드할 수 있는 origin(정확한 https origin, 최대 `MAX_FRAME_ORIGINS`개).
|
|
35
|
+
* CSP frame-src에만 실린다. 기본은 `'none'`. 임베드 프레임은 격리 프레임의 sandbox(`allow-same-origin` 없음)를
|
|
36
|
+
* 물려받으므로 출처·저장소가 필요한 플레이어(예: YouTube)는 열어도 동작하지 않는다.
|
|
37
|
+
*/
|
|
38
|
+
readonly frameOrigins?: readonly string[];
|
|
28
39
|
/**
|
|
29
40
|
* 엔트리 script의 `crossOrigin`. `'anonymous'`만 받는다(그 밖의 값은 TypeError). 주면 교차 origin 번들의
|
|
30
41
|
* 에러가 "Script error."로 가려지지 않고 메시지·스택이 보인다 — 대신 assetOrigin이 CORS
|
|
@@ -34,6 +45,13 @@ interface CreateSrcdocOptions {
|
|
|
34
45
|
}
|
|
35
46
|
/** mediaOrigins 최대 개수. */
|
|
36
47
|
declare const MAX_MEDIA_ORIGINS = 20;
|
|
48
|
+
/** frameOrigins 최대 개수. */
|
|
49
|
+
declare const MAX_FRAME_ORIGINS = 10;
|
|
50
|
+
/** `buildFrameCsp`의 선택 옵션(`createSrcdoc`의 같은 이름 옵션). */
|
|
51
|
+
interface FrameCspOptions {
|
|
52
|
+
readonly imagesAnyHttps?: boolean;
|
|
53
|
+
readonly frameOrigins?: readonly string[];
|
|
54
|
+
}
|
|
37
55
|
/**
|
|
38
56
|
* 에러 보고 묶음 대기(ms) — 첫 발생 뒤 이만큼 기다리며 같은 fingerprint를 count로 묶어 한 번 보낸다.
|
|
39
57
|
* 프로토콜에 정해지지 않은 값(구현 선택).
|
|
@@ -47,20 +65,21 @@ declare const MAX_ELEMENT_NAME_LENGTH = 100;
|
|
|
47
65
|
* connect-src는 항상 `https: wss:`다(프레임 네트워크 규칙, README "프레임 네트워크") — 토큰이 필요한 API는
|
|
48
66
|
* 부트스트랩의 `__bstage_fetch__`가 브리지로 보내고, 그 밖의 https API는 템플릿이 직접 부른다. 평문(`http:`·`ws:`)은 열지 않는다.
|
|
49
67
|
*
|
|
50
|
-
* img-src·media-src에 맨 `https:`를 두지
|
|
51
|
-
*
|
|
68
|
+
* 기본은 img-src·media-src에 맨 `https:`를 두지 않고 `mediaOrigins`로 정확한 origin만 연다. 호스트가
|
|
69
|
+
* `imagesAnyHttps`를 켜면 img-src에만 `https:`를 더한다(connect-src가 이미 `https:`라 유출 경로가 늘지 않는다).
|
|
70
|
+
* frame-src는 기본 `'none'`이고 `frameOrigins`로 정확한 https origin만 연다.
|
|
52
71
|
*
|
|
53
|
-
* @throws TypeError mediaOrigins가 형식에 맞지 않을 때
|
|
72
|
+
* @throws TypeError mediaOrigins·options가 형식에 맞지 않을 때
|
|
54
73
|
*/
|
|
55
|
-
declare function buildFrameCsp(nonce: string, assetOrigin: string, mediaOrigins?: readonly string[]): string;
|
|
74
|
+
declare function buildFrameCsp(nonce: string, assetOrigin: string, mediaOrigins?: readonly string[], options?: FrameCspOptions): string;
|
|
56
75
|
/**
|
|
57
76
|
* 격리 프레임의 srcdoc 문서를 만든다. 모든 보간 값은 검증하고 문맥에 맞게 이스케이프한다
|
|
58
77
|
* (HTML 속성·텍스트는 HTML 이스케이프, 스크립트 안은 JSON + `<`·`>`·`&` 유니코드 이스케이프).
|
|
59
78
|
*
|
|
60
79
|
* iframe 속성은 `IFRAME_ATTRIBUTES`(sandbox="allow-scripts" 등)를 쓴다.
|
|
61
80
|
*
|
|
62
|
-
* @throws TypeError 입력이 형식에 맞지 않을 때(잘못된 nonce·세션·origin·엔트리·요소 이름·mediaOrigins·crossOrigin)
|
|
81
|
+
* @throws TypeError 입력이 형식에 맞지 않을 때(잘못된 nonce·세션·origin·엔트리·요소 이름·mediaOrigins·imagesAnyHttps·frameOrigins·crossOrigin)
|
|
63
82
|
*/
|
|
64
83
|
declare function createSrcdoc(options: CreateSrcdocOptions): string;
|
|
65
84
|
|
|
66
|
-
export { type CreateSrcdocOptions as C, MAX_ELEMENT_NAME_LENGTH as M, REPORT_FLUSH_DELAY_MS as R,
|
|
85
|
+
export { type CreateSrcdocOptions as C, type FrameCspOptions as F, MAX_ELEMENT_NAME_LENGTH as M, REPORT_FLUSH_DELAY_MS as R, MAX_FRAME_ORIGINS as a, MAX_MEDIA_ORIGINS as b, buildFrameCsp as c, createNonce as d, createSession as e, createSrcdoc as f, isValidSession as g, isValidNonce as i };
|
|
@@ -25,6 +25,17 @@ interface CreateSrcdocOptions {
|
|
|
25
25
|
* CSP img-src·media-src에만 더해진다. 잘못된 항목이 하나라도 있으면 TypeError.
|
|
26
26
|
*/
|
|
27
27
|
readonly mediaOrigins?: readonly string[];
|
|
28
|
+
/**
|
|
29
|
+
* `true`면 CSP img-src에 `https:`를 더해 모든 https 이미지(외부 썸네일 등)를 연다. media-src·font-src는 그대로.
|
|
30
|
+
* 프레임은 이미 `connect-src https:`로 임의 https에 요청할 수 있으므로 새 유출 경로는 생기지 않는다. 기본 `false`.
|
|
31
|
+
*/
|
|
32
|
+
readonly imagesAnyHttps?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 템플릿이 `<iframe>`으로 임베드할 수 있는 origin(정확한 https origin, 최대 `MAX_FRAME_ORIGINS`개).
|
|
35
|
+
* CSP frame-src에만 실린다. 기본은 `'none'`. 임베드 프레임은 격리 프레임의 sandbox(`allow-same-origin` 없음)를
|
|
36
|
+
* 물려받으므로 출처·저장소가 필요한 플레이어(예: YouTube)는 열어도 동작하지 않는다.
|
|
37
|
+
*/
|
|
38
|
+
readonly frameOrigins?: readonly string[];
|
|
28
39
|
/**
|
|
29
40
|
* 엔트리 script의 `crossOrigin`. `'anonymous'`만 받는다(그 밖의 값은 TypeError). 주면 교차 origin 번들의
|
|
30
41
|
* 에러가 "Script error."로 가려지지 않고 메시지·스택이 보인다 — 대신 assetOrigin이 CORS
|
|
@@ -34,6 +45,13 @@ interface CreateSrcdocOptions {
|
|
|
34
45
|
}
|
|
35
46
|
/** mediaOrigins 최대 개수. */
|
|
36
47
|
declare const MAX_MEDIA_ORIGINS = 20;
|
|
48
|
+
/** frameOrigins 최대 개수. */
|
|
49
|
+
declare const MAX_FRAME_ORIGINS = 10;
|
|
50
|
+
/** `buildFrameCsp`의 선택 옵션(`createSrcdoc`의 같은 이름 옵션). */
|
|
51
|
+
interface FrameCspOptions {
|
|
52
|
+
readonly imagesAnyHttps?: boolean;
|
|
53
|
+
readonly frameOrigins?: readonly string[];
|
|
54
|
+
}
|
|
37
55
|
/**
|
|
38
56
|
* 에러 보고 묶음 대기(ms) — 첫 발생 뒤 이만큼 기다리며 같은 fingerprint를 count로 묶어 한 번 보낸다.
|
|
39
57
|
* 프로토콜에 정해지지 않은 값(구현 선택).
|
|
@@ -47,20 +65,21 @@ declare const MAX_ELEMENT_NAME_LENGTH = 100;
|
|
|
47
65
|
* connect-src는 항상 `https: wss:`다(프레임 네트워크 규칙, README "프레임 네트워크") — 토큰이 필요한 API는
|
|
48
66
|
* 부트스트랩의 `__bstage_fetch__`가 브리지로 보내고, 그 밖의 https API는 템플릿이 직접 부른다. 평문(`http:`·`ws:`)은 열지 않는다.
|
|
49
67
|
*
|
|
50
|
-
* img-src·media-src에 맨 `https:`를 두지
|
|
51
|
-
*
|
|
68
|
+
* 기본은 img-src·media-src에 맨 `https:`를 두지 않고 `mediaOrigins`로 정확한 origin만 연다. 호스트가
|
|
69
|
+
* `imagesAnyHttps`를 켜면 img-src에만 `https:`를 더한다(connect-src가 이미 `https:`라 유출 경로가 늘지 않는다).
|
|
70
|
+
* frame-src는 기본 `'none'`이고 `frameOrigins`로 정확한 https origin만 연다.
|
|
52
71
|
*
|
|
53
|
-
* @throws TypeError mediaOrigins가 형식에 맞지 않을 때
|
|
72
|
+
* @throws TypeError mediaOrigins·options가 형식에 맞지 않을 때
|
|
54
73
|
*/
|
|
55
|
-
declare function buildFrameCsp(nonce: string, assetOrigin: string, mediaOrigins?: readonly string[]): string;
|
|
74
|
+
declare function buildFrameCsp(nonce: string, assetOrigin: string, mediaOrigins?: readonly string[], options?: FrameCspOptions): string;
|
|
56
75
|
/**
|
|
57
76
|
* 격리 프레임의 srcdoc 문서를 만든다. 모든 보간 값은 검증하고 문맥에 맞게 이스케이프한다
|
|
58
77
|
* (HTML 속성·텍스트는 HTML 이스케이프, 스크립트 안은 JSON + `<`·`>`·`&` 유니코드 이스케이프).
|
|
59
78
|
*
|
|
60
79
|
* iframe 속성은 `IFRAME_ATTRIBUTES`(sandbox="allow-scripts" 등)를 쓴다.
|
|
61
80
|
*
|
|
62
|
-
* @throws TypeError 입력이 형식에 맞지 않을 때(잘못된 nonce·세션·origin·엔트리·요소 이름·mediaOrigins·crossOrigin)
|
|
81
|
+
* @throws TypeError 입력이 형식에 맞지 않을 때(잘못된 nonce·세션·origin·엔트리·요소 이름·mediaOrigins·imagesAnyHttps·frameOrigins·crossOrigin)
|
|
63
82
|
*/
|
|
64
83
|
declare function createSrcdoc(options: CreateSrcdocOptions): string;
|
|
65
84
|
|
|
66
|
-
export { type CreateSrcdocOptions as C, MAX_ELEMENT_NAME_LENGTH as M, REPORT_FLUSH_DELAY_MS as R,
|
|
85
|
+
export { type CreateSrcdocOptions as C, type FrameCspOptions as F, MAX_ELEMENT_NAME_LENGTH as M, REPORT_FLUSH_DELAY_MS as R, MAX_FRAME_ORIGINS as a, MAX_MEDIA_ORIGINS as b, buildFrameCsp as c, createNonce as d, createSession as e, createSrcdoc as f, isValidSession as g, isValidNonce as i };
|
package/dist/frame.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as BridgeInit, l as BridgeRequestType, k as BridgeRequestMap, g as BridgeEventMap, Z as TemplateReportKind } from './messages-
|
|
1
|
+
import { i as BridgeInit, l as BridgeRequestType, k as BridgeRequestMap, g as BridgeEventMap, Z as TemplateReportKind } from './messages-B4TTkSkI.cjs';
|
|
2
2
|
|
|
3
3
|
/** 프레임 런타임 설정 — srcdoc 부트스트랩이 상수로 넘긴다. */
|
|
4
4
|
interface BridgeClientConfig {
|
package/dist/frame.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as BridgeInit, l as BridgeRequestType, k as BridgeRequestMap, g as BridgeEventMap, Z as TemplateReportKind } from './messages-
|
|
1
|
+
import { i as BridgeInit, l as BridgeRequestType, k as BridgeRequestMap, g as BridgeEventMap, Z as TemplateReportKind } from './messages-B4TTkSkI.js';
|
|
2
2
|
|
|
3
3
|
/** 프레임 런타임 설정 — srcdoc 부트스트랩이 상수로 넘긴다. */
|
|
4
4
|
interface BridgeClientConfig {
|
package/dist/host.cjs
CHANGED
|
@@ -2765,6 +2765,7 @@ function renderFrameCss() {
|
|
|
2765
2765
|
// src/srcdoc/createSrcdoc.ts
|
|
2766
2766
|
var FRAME_TOKEN_CSS = renderFrameCss();
|
|
2767
2767
|
var MAX_MEDIA_ORIGINS = 20;
|
|
2768
|
+
var MAX_FRAME_ORIGINS = 10;
|
|
2768
2769
|
var REPORT_FLUSH_DELAY_MS = 1e3;
|
|
2769
2770
|
var MAX_ELEMENT_NAME_LENGTH = 100;
|
|
2770
2771
|
var ELEMENT_NAME_RE = /^[a-z][a-z0-9._]*-[a-z0-9._-]*$/;
|
|
@@ -2788,34 +2789,50 @@ function assertEntryUrl(entryUrl, assetOrigin) {
|
|
|
2788
2789
|
}
|
|
2789
2790
|
return parsed.href;
|
|
2790
2791
|
}
|
|
2791
|
-
function
|
|
2792
|
+
function normalizeHttpsOrigins(label, value, max) {
|
|
2792
2793
|
if (value === void 0) return Object.freeze([]);
|
|
2793
2794
|
if (!Array.isArray(value)) {
|
|
2794
|
-
throw new TypeError(
|
|
2795
|
+
throw new TypeError(`[bstage-bridge] ${label}\uB294 \uBC30\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`);
|
|
2795
2796
|
}
|
|
2796
|
-
if (value.length >
|
|
2797
|
-
throw new TypeError(`[bstage-bridge]
|
|
2797
|
+
if (value.length > max) {
|
|
2798
|
+
throw new TypeError(`[bstage-bridge] ${label}\uB294 \uCD5C\uB300 ${max}\uAC1C\uC785\uB2C8\uB2E4`);
|
|
2798
2799
|
}
|
|
2799
2800
|
const origins = value.map((o) => {
|
|
2800
2801
|
const origin = normalizeExactOrigin(o, ["https:"]);
|
|
2801
2802
|
if (!origin) {
|
|
2802
|
-
throw new TypeError(
|
|
2803
|
+
throw new TypeError(`[bstage-bridge] ${label} \uD56D\uBAA9\uC740 \uC815\uD655\uD55C https origin\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`);
|
|
2803
2804
|
}
|
|
2804
2805
|
return origin;
|
|
2805
2806
|
});
|
|
2806
2807
|
return Object.freeze([...new Set(origins)]);
|
|
2807
2808
|
}
|
|
2808
|
-
function
|
|
2809
|
+
function normalizeMediaOrigins(value) {
|
|
2810
|
+
return normalizeHttpsOrigins("mediaOrigins", value, MAX_MEDIA_ORIGINS);
|
|
2811
|
+
}
|
|
2812
|
+
function normalizeFrameOrigins(value) {
|
|
2813
|
+
return normalizeHttpsOrigins("frameOrigins", value, MAX_FRAME_ORIGINS);
|
|
2814
|
+
}
|
|
2815
|
+
function normalizeImagesAnyHttps(value) {
|
|
2816
|
+
if (value === void 0) return false;
|
|
2817
|
+
if (typeof value !== "boolean") {
|
|
2818
|
+
throw new TypeError("[bstage-bridge] imagesAnyHttps\uB294 \uBD88\uB9AC\uC5B8\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4");
|
|
2819
|
+
}
|
|
2820
|
+
return value;
|
|
2821
|
+
}
|
|
2822
|
+
function buildFrameCsp(nonce, assetOrigin, mediaOrigins = [], options = {}) {
|
|
2809
2823
|
const media = [assetOrigin, ...normalizeMediaOrigins(mediaOrigins)].join(" ");
|
|
2824
|
+
const images = normalizeImagesAnyHttps(options.imagesAnyHttps) ? `${media} https:` : media;
|
|
2825
|
+
const frames = normalizeFrameOrigins(options.frameOrigins);
|
|
2826
|
+
const frameSrc = frames.length > 0 ? frames.join(" ") : "'none'";
|
|
2810
2827
|
return [
|
|
2811
2828
|
"default-src 'none'",
|
|
2812
2829
|
`script-src 'nonce-${nonce}' ${assetOrigin}`,
|
|
2813
2830
|
`style-src 'unsafe-inline' ${assetOrigin}`,
|
|
2814
|
-
`img-src ${
|
|
2831
|
+
`img-src ${images} data: blob:`,
|
|
2815
2832
|
`font-src ${assetOrigin} data:`,
|
|
2816
2833
|
`media-src ${media} blob:`,
|
|
2817
2834
|
"connect-src https: wss:",
|
|
2818
|
-
|
|
2835
|
+
`frame-src ${frameSrc}`,
|
|
2819
2836
|
"form-action 'none'",
|
|
2820
2837
|
"base-uri 'none'"
|
|
2821
2838
|
].join("; ");
|
|
@@ -2899,11 +2916,13 @@ function createSrcdoc(options) {
|
|
|
2899
2916
|
}
|
|
2900
2917
|
if (typeof title !== "string") throw new TypeError("[bstage-bridge] title\uC740 \uBB38\uC790\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4");
|
|
2901
2918
|
const mediaOrigins = normalizeMediaOrigins(options.mediaOrigins);
|
|
2919
|
+
const imagesAnyHttps = normalizeImagesAnyHttps(options.imagesAnyHttps);
|
|
2920
|
+
const frameOrigins = normalizeFrameOrigins(options.frameOrigins);
|
|
2902
2921
|
const { crossOrigin } = options;
|
|
2903
2922
|
if (crossOrigin !== void 0 && crossOrigin !== "anonymous") {
|
|
2904
2923
|
throw new TypeError("[bstage-bridge] crossOrigin\uC740 'anonymous'\uB9CC \uBC1B\uC2B5\uB2C8\uB2E4");
|
|
2905
2924
|
}
|
|
2906
|
-
const csp = buildFrameCsp(nonce, assetOrigin, mediaOrigins);
|
|
2925
|
+
const csp = buildFrameCsp(nonce, assetOrigin, mediaOrigins, { imagesAnyHttps, frameOrigins });
|
|
2907
2926
|
const script = bootstrapScript({ session, hostOrigin, entryUrl, elementName, crossOrigin });
|
|
2908
2927
|
if (/<\/script|<!--/i.test(script)) {
|
|
2909
2928
|
throw new Error("[bstage-bridge] \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uC2A4\uD06C\uB9BD\uD2B8\uC5D0 \uC2A4\uD06C\uB9BD\uD2B8 \uC885\uB8CC \uC2DC\uD000\uC2A4\uAC00 \uC788\uC2B5\uB2C8\uB2E4");
|
package/dist/host.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as BridgeHostEventType, g as BridgeEventMap, N as NavigateOptions, $ as ToastKind, L as LogLevel, n as BridgeSurface, _ as ThemeState, V as SlotState, M as MemberState, o as BridgeTranslations, w as PageLocationState, a as AccountHostQuery, b as AccountSpaceInfo, J as ReverificationStatus, Q as SessionOp, s as OtpOp, t as OtpPurpose, Y as TemplateReport } from './messages-
|
|
2
|
-
export { A as ACCOUNT_SESSION_CAPABILITY, c as BRIDGE_SURFACES, I as IFRAME_ATTRIBUTES, x as REPORTS_PER_SESSION, Z as TemplateReportKind, a3 as isBridgeSurface } from './messages-
|
|
3
|
-
export { C as CreateSrcdocOptions,
|
|
1
|
+
import { h as BridgeHostEventType, g as BridgeEventMap, N as NavigateOptions, $ as ToastKind, L as LogLevel, n as BridgeSurface, _ as ThemeState, V as SlotState, M as MemberState, o as BridgeTranslations, w as PageLocationState, a as AccountHostQuery, b as AccountSpaceInfo, J as ReverificationStatus, Q as SessionOp, s as OtpOp, t as OtpPurpose, Y as TemplateReport } from './messages-B4TTkSkI.cjs';
|
|
2
|
+
export { A as ACCOUNT_SESSION_CAPABILITY, c as BRIDGE_SURFACES, I as IFRAME_ATTRIBUTES, x as REPORTS_PER_SESSION, Z as TemplateReportKind, a3 as isBridgeSurface } from './messages-B4TTkSkI.cjs';
|
|
3
|
+
export { C as CreateSrcdocOptions, d as createNonce, e as createSession, f as createSrcdoc, g as isValidSession } from './createSrcdoc-BT92gCXB.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 계정 세션 요청(session·otp) 처리. 호스트가 계정 API를 대신 부르고 로그인 쿠키를 호스트에서 설정한다.
|
|
@@ -282,7 +282,7 @@ interface BridgeHostHandlers {
|
|
|
282
282
|
/** 없으면 `window.open(url, '_blank', 'noopener,noreferrer')`. */
|
|
283
283
|
readonly openExternal?: (url: string) => void;
|
|
284
284
|
/**
|
|
285
|
-
* 같은 탭 외부 이동(https만, userinfo 없음 — 검증된 href).
|
|
285
|
+
* 같은 탭 외부 이동(https만, userinfo 없음 — 검증된 href). 이동 여부는 처리기가 정한다(확인 창·사용자 활성화 검사 등).
|
|
286
286
|
* 없으면 `UNSUPPORTED`(window.open 등 기본 동작으로 대신하지 않는다).
|
|
287
287
|
*/
|
|
288
288
|
readonly navigateExternal?: (url: string) => void;
|
package/dist/host.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as BridgeHostEventType, g as BridgeEventMap, N as NavigateOptions, $ as ToastKind, L as LogLevel, n as BridgeSurface, _ as ThemeState, V as SlotState, M as MemberState, o as BridgeTranslations, w as PageLocationState, a as AccountHostQuery, b as AccountSpaceInfo, J as ReverificationStatus, Q as SessionOp, s as OtpOp, t as OtpPurpose, Y as TemplateReport } from './messages-
|
|
2
|
-
export { A as ACCOUNT_SESSION_CAPABILITY, c as BRIDGE_SURFACES, I as IFRAME_ATTRIBUTES, x as REPORTS_PER_SESSION, Z as TemplateReportKind, a3 as isBridgeSurface } from './messages-
|
|
3
|
-
export { C as CreateSrcdocOptions,
|
|
1
|
+
import { h as BridgeHostEventType, g as BridgeEventMap, N as NavigateOptions, $ as ToastKind, L as LogLevel, n as BridgeSurface, _ as ThemeState, V as SlotState, M as MemberState, o as BridgeTranslations, w as PageLocationState, a as AccountHostQuery, b as AccountSpaceInfo, J as ReverificationStatus, Q as SessionOp, s as OtpOp, t as OtpPurpose, Y as TemplateReport } from './messages-B4TTkSkI.js';
|
|
2
|
+
export { A as ACCOUNT_SESSION_CAPABILITY, c as BRIDGE_SURFACES, I as IFRAME_ATTRIBUTES, x as REPORTS_PER_SESSION, Z as TemplateReportKind, a3 as isBridgeSurface } from './messages-B4TTkSkI.js';
|
|
3
|
+
export { C as CreateSrcdocOptions, d as createNonce, e as createSession, f as createSrcdoc, g as isValidSession } from './createSrcdoc-BT92gCXB.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 계정 세션 요청(session·otp) 처리. 호스트가 계정 API를 대신 부르고 로그인 쿠키를 호스트에서 설정한다.
|
|
@@ -282,7 +282,7 @@ interface BridgeHostHandlers {
|
|
|
282
282
|
/** 없으면 `window.open(url, '_blank', 'noopener,noreferrer')`. */
|
|
283
283
|
readonly openExternal?: (url: string) => void;
|
|
284
284
|
/**
|
|
285
|
-
* 같은 탭 외부 이동(https만, userinfo 없음 — 검증된 href).
|
|
285
|
+
* 같은 탭 외부 이동(https만, userinfo 없음 — 검증된 href). 이동 여부는 처리기가 정한다(확인 창·사용자 활성화 검사 등).
|
|
286
286
|
* 없으면 `UNSUPPORTED`(window.open 등 기본 동작으로 대신하지 않는다).
|
|
287
287
|
*/
|
|
288
288
|
readonly navigateExternal?: (url: string) => void;
|
package/dist/host.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(src_exports, {
|
|
|
34
34
|
MAX_ELEMENT_NAME_LENGTH: () => MAX_ELEMENT_NAME_LENGTH,
|
|
35
35
|
MAX_ENVELOPE_ID_LENGTH: () => MAX_ENVELOPE_ID_LENGTH,
|
|
36
36
|
MAX_ENVELOPE_TYPE_LENGTH: () => MAX_ENVELOPE_TYPE_LENGTH,
|
|
37
|
+
MAX_FRAME_ORIGINS: () => MAX_FRAME_ORIGINS,
|
|
37
38
|
MAX_MEDIA_ORIGINS: () => MAX_MEDIA_ORIGINS,
|
|
38
39
|
OTP_OPS: () => OTP_OPS,
|
|
39
40
|
PAGE_LOCATION_MAX_LENGTH: () => PAGE_LOCATION_MAX_LENGTH,
|
|
@@ -1463,6 +1464,7 @@ function renderFrameCss() {
|
|
|
1463
1464
|
// src/srcdoc/createSrcdoc.ts
|
|
1464
1465
|
var FRAME_TOKEN_CSS = renderFrameCss();
|
|
1465
1466
|
var MAX_MEDIA_ORIGINS = 20;
|
|
1467
|
+
var MAX_FRAME_ORIGINS = 10;
|
|
1466
1468
|
var REPORT_FLUSH_DELAY_MS = 1e3;
|
|
1467
1469
|
var MAX_ELEMENT_NAME_LENGTH = 100;
|
|
1468
1470
|
var ELEMENT_NAME_RE = /^[a-z][a-z0-9._]*-[a-z0-9._-]*$/;
|
|
@@ -1486,34 +1488,50 @@ function assertEntryUrl(entryUrl, assetOrigin) {
|
|
|
1486
1488
|
}
|
|
1487
1489
|
return parsed.href;
|
|
1488
1490
|
}
|
|
1489
|
-
function
|
|
1491
|
+
function normalizeHttpsOrigins(label, value, max) {
|
|
1490
1492
|
if (value === void 0) return Object.freeze([]);
|
|
1491
1493
|
if (!Array.isArray(value)) {
|
|
1492
|
-
throw new TypeError(
|
|
1494
|
+
throw new TypeError(`[bstage-bridge] ${label}\uB294 \uBC30\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`);
|
|
1493
1495
|
}
|
|
1494
|
-
if (value.length >
|
|
1495
|
-
throw new TypeError(`[bstage-bridge]
|
|
1496
|
+
if (value.length > max) {
|
|
1497
|
+
throw new TypeError(`[bstage-bridge] ${label}\uB294 \uCD5C\uB300 ${max}\uAC1C\uC785\uB2C8\uB2E4`);
|
|
1496
1498
|
}
|
|
1497
1499
|
const origins = value.map((o) => {
|
|
1498
1500
|
const origin = normalizeExactOrigin(o, ["https:"]);
|
|
1499
1501
|
if (!origin) {
|
|
1500
|
-
throw new TypeError(
|
|
1502
|
+
throw new TypeError(`[bstage-bridge] ${label} \uD56D\uBAA9\uC740 \uC815\uD655\uD55C https origin\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`);
|
|
1501
1503
|
}
|
|
1502
1504
|
return origin;
|
|
1503
1505
|
});
|
|
1504
1506
|
return Object.freeze([...new Set(origins)]);
|
|
1505
1507
|
}
|
|
1506
|
-
function
|
|
1508
|
+
function normalizeMediaOrigins(value) {
|
|
1509
|
+
return normalizeHttpsOrigins("mediaOrigins", value, MAX_MEDIA_ORIGINS);
|
|
1510
|
+
}
|
|
1511
|
+
function normalizeFrameOrigins(value) {
|
|
1512
|
+
return normalizeHttpsOrigins("frameOrigins", value, MAX_FRAME_ORIGINS);
|
|
1513
|
+
}
|
|
1514
|
+
function normalizeImagesAnyHttps(value) {
|
|
1515
|
+
if (value === void 0) return false;
|
|
1516
|
+
if (typeof value !== "boolean") {
|
|
1517
|
+
throw new TypeError("[bstage-bridge] imagesAnyHttps\uB294 \uBD88\uB9AC\uC5B8\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4");
|
|
1518
|
+
}
|
|
1519
|
+
return value;
|
|
1520
|
+
}
|
|
1521
|
+
function buildFrameCsp(nonce, assetOrigin, mediaOrigins = [], options = {}) {
|
|
1507
1522
|
const media = [assetOrigin, ...normalizeMediaOrigins(mediaOrigins)].join(" ");
|
|
1523
|
+
const images = normalizeImagesAnyHttps(options.imagesAnyHttps) ? `${media} https:` : media;
|
|
1524
|
+
const frames = normalizeFrameOrigins(options.frameOrigins);
|
|
1525
|
+
const frameSrc = frames.length > 0 ? frames.join(" ") : "'none'";
|
|
1508
1526
|
return [
|
|
1509
1527
|
"default-src 'none'",
|
|
1510
1528
|
`script-src 'nonce-${nonce}' ${assetOrigin}`,
|
|
1511
1529
|
`style-src 'unsafe-inline' ${assetOrigin}`,
|
|
1512
|
-
`img-src ${
|
|
1530
|
+
`img-src ${images} data: blob:`,
|
|
1513
1531
|
`font-src ${assetOrigin} data:`,
|
|
1514
1532
|
`media-src ${media} blob:`,
|
|
1515
1533
|
"connect-src https: wss:",
|
|
1516
|
-
|
|
1534
|
+
`frame-src ${frameSrc}`,
|
|
1517
1535
|
"form-action 'none'",
|
|
1518
1536
|
"base-uri 'none'"
|
|
1519
1537
|
].join("; ");
|
|
@@ -1597,11 +1615,13 @@ function createSrcdoc(options) {
|
|
|
1597
1615
|
}
|
|
1598
1616
|
if (typeof title !== "string") throw new TypeError("[bstage-bridge] title\uC740 \uBB38\uC790\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4");
|
|
1599
1617
|
const mediaOrigins = normalizeMediaOrigins(options.mediaOrigins);
|
|
1618
|
+
const imagesAnyHttps = normalizeImagesAnyHttps(options.imagesAnyHttps);
|
|
1619
|
+
const frameOrigins = normalizeFrameOrigins(options.frameOrigins);
|
|
1600
1620
|
const { crossOrigin } = options;
|
|
1601
1621
|
if (crossOrigin !== void 0 && crossOrigin !== "anonymous") {
|
|
1602
1622
|
throw new TypeError("[bstage-bridge] crossOrigin\uC740 'anonymous'\uB9CC \uBC1B\uC2B5\uB2C8\uB2E4");
|
|
1603
1623
|
}
|
|
1604
|
-
const csp = buildFrameCsp(nonce, assetOrigin, mediaOrigins);
|
|
1624
|
+
const csp = buildFrameCsp(nonce, assetOrigin, mediaOrigins, { imagesAnyHttps, frameOrigins });
|
|
1605
1625
|
const script = bootstrapScript({ session, hostOrigin, entryUrl, elementName, crossOrigin });
|
|
1606
1626
|
if (/<\/script|<!--/i.test(script)) {
|
|
1607
1627
|
throw new Error("[bstage-bridge] \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uC2A4\uD06C\uB9BD\uD2B8\uC5D0 \uC2A4\uD06C\uB9BD\uD2B8 \uC885\uB8CC \uC2DC\uD000\uC2A4\uAC00 \uC788\uC2B5\uB2C8\uB2E4");
|
|
@@ -1647,6 +1667,7 @@ ${script}
|
|
|
1647
1667
|
MAX_ELEMENT_NAME_LENGTH,
|
|
1648
1668
|
MAX_ENVELOPE_ID_LENGTH,
|
|
1649
1669
|
MAX_ENVELOPE_TYPE_LENGTH,
|
|
1670
|
+
MAX_FRAME_ORIGINS,
|
|
1650
1671
|
MAX_MEDIA_ORIGINS,
|
|
1651
1672
|
OTP_OPS,
|
|
1652
1673
|
PAGE_LOCATION_MAX_LENGTH,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ACCOUNT_SESSION_CAPABILITY, a as AccountHostQuery, b as AccountSpaceInfo, B as BRIDGE_ERROR_CODES, c as BRIDGE_SURFACES, d as BridgeError, e as BridgeErrorCode, f as BridgeErrorLike, g as BridgeEventMap, h as BridgeHostEventType, i as BridgeInit, j as BridgeLimits, k as BridgeRequestMap, l as BridgeRequestType, m as BridgeResult, n as BridgeSurface, o as BridgeTranslations, F as FRAME_UNLOAD_EVENT, p as FetchRequest, q as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, r as INIT_RESPONSE, K as KNOWN_CAPABILITIES, L as LogLevel, M as MemberState, N as NavigateOptions, O as OTP_OPS, s as OtpOp, t as OtpPurpose, u as OtpRequest, v as OtpResult, P as PAGE_LOCATION_MAX_LENGTH, w as PageLocationState, R as READY_EVENT, x as REPORTS_PER_SESSION, y as REPORT_COUNT_MAX, z as REPORT_FRAME_MAX_LENGTH, C as REPORT_MAX_FRAMES, D as REPORT_MESSAGE_MAX_LENGTH, E as REQUEST_TIMEOUT_MS, G as REQUEST_TYPES, J as ReverificationStatus, S as SESSION_OPS, Q as SessionOp, T as SessionRequest, U as SessionResult, V as SlotState, W as StorageOp, X as TEMPLATE_REPORT_KINDS, Y as TemplateReport, Z as TemplateReportKind, _ as ThemeState, $ as ToastKind, a0 as WithSession, a1 as isBridgeErrorCode, a2 as isBridgeErrorLike, a3 as isBridgeSurface, a4 as isHostEventType, a5 as isRequestType, a6 as toPageLocation } from './messages-
|
|
2
|
-
export { C as CreateSrcdocOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_MEDIA_ORIGINS, R as REPORT_FLUSH_DELAY_MS,
|
|
1
|
+
export { A as ACCOUNT_SESSION_CAPABILITY, a as AccountHostQuery, b as AccountSpaceInfo, B as BRIDGE_ERROR_CODES, c as BRIDGE_SURFACES, d as BridgeError, e as BridgeErrorCode, f as BridgeErrorLike, g as BridgeEventMap, h as BridgeHostEventType, i as BridgeInit, j as BridgeLimits, k as BridgeRequestMap, l as BridgeRequestType, m as BridgeResult, n as BridgeSurface, o as BridgeTranslations, F as FRAME_UNLOAD_EVENT, p as FetchRequest, q as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, r as INIT_RESPONSE, K as KNOWN_CAPABILITIES, L as LogLevel, M as MemberState, N as NavigateOptions, O as OTP_OPS, s as OtpOp, t as OtpPurpose, u as OtpRequest, v as OtpResult, P as PAGE_LOCATION_MAX_LENGTH, w as PageLocationState, R as READY_EVENT, x as REPORTS_PER_SESSION, y as REPORT_COUNT_MAX, z as REPORT_FRAME_MAX_LENGTH, C as REPORT_MAX_FRAMES, D as REPORT_MESSAGE_MAX_LENGTH, E as REQUEST_TIMEOUT_MS, G as REQUEST_TYPES, J as ReverificationStatus, S as SESSION_OPS, Q as SessionOp, T as SessionRequest, U as SessionResult, V as SlotState, W as StorageOp, X as TEMPLATE_REPORT_KINDS, Y as TemplateReport, Z as TemplateReportKind, _ as ThemeState, $ as ToastKind, a0 as WithSession, a1 as isBridgeErrorCode, a2 as isBridgeErrorLike, a3 as isBridgeSurface, a4 as isHostEventType, a5 as isRequestType, a6 as toPageLocation } from './messages-B4TTkSkI.cjs';
|
|
2
|
+
export { C as CreateSrcdocOptions, F as FrameCspOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_FRAME_ORIGINS, b as MAX_MEDIA_ORIGINS, R as REPORT_FLUSH_DELAY_MS, c as buildFrameCsp, d as createNonce, e as createSession, f as createSrcdoc, i as isValidNonce, g as isValidSession } from './createSrcdoc-BT92gCXB.cjs';
|
|
3
3
|
|
|
4
4
|
/** 봉투 버전. 형식이 하위 호환되지 않게 바뀔 때만 올린다. */
|
|
5
5
|
declare const BRIDGE_VERSION = 1;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ACCOUNT_SESSION_CAPABILITY, a as AccountHostQuery, b as AccountSpaceInfo, B as BRIDGE_ERROR_CODES, c as BRIDGE_SURFACES, d as BridgeError, e as BridgeErrorCode, f as BridgeErrorLike, g as BridgeEventMap, h as BridgeHostEventType, i as BridgeInit, j as BridgeLimits, k as BridgeRequestMap, l as BridgeRequestType, m as BridgeResult, n as BridgeSurface, o as BridgeTranslations, F as FRAME_UNLOAD_EVENT, p as FetchRequest, q as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, r as INIT_RESPONSE, K as KNOWN_CAPABILITIES, L as LogLevel, M as MemberState, N as NavigateOptions, O as OTP_OPS, s as OtpOp, t as OtpPurpose, u as OtpRequest, v as OtpResult, P as PAGE_LOCATION_MAX_LENGTH, w as PageLocationState, R as READY_EVENT, x as REPORTS_PER_SESSION, y as REPORT_COUNT_MAX, z as REPORT_FRAME_MAX_LENGTH, C as REPORT_MAX_FRAMES, D as REPORT_MESSAGE_MAX_LENGTH, E as REQUEST_TIMEOUT_MS, G as REQUEST_TYPES, J as ReverificationStatus, S as SESSION_OPS, Q as SessionOp, T as SessionRequest, U as SessionResult, V as SlotState, W as StorageOp, X as TEMPLATE_REPORT_KINDS, Y as TemplateReport, Z as TemplateReportKind, _ as ThemeState, $ as ToastKind, a0 as WithSession, a1 as isBridgeErrorCode, a2 as isBridgeErrorLike, a3 as isBridgeSurface, a4 as isHostEventType, a5 as isRequestType, a6 as toPageLocation } from './messages-
|
|
2
|
-
export { C as CreateSrcdocOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_MEDIA_ORIGINS, R as REPORT_FLUSH_DELAY_MS,
|
|
1
|
+
export { A as ACCOUNT_SESSION_CAPABILITY, a as AccountHostQuery, b as AccountSpaceInfo, B as BRIDGE_ERROR_CODES, c as BRIDGE_SURFACES, d as BridgeError, e as BridgeErrorCode, f as BridgeErrorLike, g as BridgeEventMap, h as BridgeHostEventType, i as BridgeInit, j as BridgeLimits, k as BridgeRequestMap, l as BridgeRequestType, m as BridgeResult, n as BridgeSurface, o as BridgeTranslations, F as FRAME_UNLOAD_EVENT, p as FetchRequest, q as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, r as INIT_RESPONSE, K as KNOWN_CAPABILITIES, L as LogLevel, M as MemberState, N as NavigateOptions, O as OTP_OPS, s as OtpOp, t as OtpPurpose, u as OtpRequest, v as OtpResult, P as PAGE_LOCATION_MAX_LENGTH, w as PageLocationState, R as READY_EVENT, x as REPORTS_PER_SESSION, y as REPORT_COUNT_MAX, z as REPORT_FRAME_MAX_LENGTH, C as REPORT_MAX_FRAMES, D as REPORT_MESSAGE_MAX_LENGTH, E as REQUEST_TIMEOUT_MS, G as REQUEST_TYPES, J as ReverificationStatus, S as SESSION_OPS, Q as SessionOp, T as SessionRequest, U as SessionResult, V as SlotState, W as StorageOp, X as TEMPLATE_REPORT_KINDS, Y as TemplateReport, Z as TemplateReportKind, _ as ThemeState, $ as ToastKind, a0 as WithSession, a1 as isBridgeErrorCode, a2 as isBridgeErrorLike, a3 as isBridgeSurface, a4 as isHostEventType, a5 as isRequestType, a6 as toPageLocation } from './messages-B4TTkSkI.js';
|
|
2
|
+
export { C as CreateSrcdocOptions, F as FrameCspOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_FRAME_ORIGINS, b as MAX_MEDIA_ORIGINS, R as REPORT_FLUSH_DELAY_MS, c as buildFrameCsp, d as createNonce, e as createSession, f as createSrcdoc, i as isValidNonce, g as isValidSession } from './createSrcdoc-BT92gCXB.js';
|
|
3
3
|
|
|
4
4
|
/** 봉투 버전. 형식이 하위 호환되지 않게 바뀔 때만 올린다. */
|
|
5
5
|
declare const BRIDGE_VERSION = 1;
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
MAX_ELEMENT_NAME_LENGTH,
|
|
14
14
|
MAX_ENVELOPE_ID_LENGTH,
|
|
15
15
|
MAX_ENVELOPE_TYPE_LENGTH,
|
|
16
|
+
MAX_FRAME_ORIGINS,
|
|
16
17
|
MAX_MEDIA_ORIGINS,
|
|
17
18
|
OTP_OPS,
|
|
18
19
|
PAGE_LOCATION_MAX_LENGTH,
|
|
@@ -42,7 +43,7 @@ import {
|
|
|
42
43
|
isValidNonce,
|
|
43
44
|
isValidSession,
|
|
44
45
|
toPageLocation
|
|
45
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-PIBPZZGO.js";
|
|
46
47
|
import "./chunk-B3TKEEX3.js";
|
|
47
48
|
export {
|
|
48
49
|
ACCOUNT_SESSION_CAPABILITY,
|
|
@@ -59,6 +60,7 @@ export {
|
|
|
59
60
|
MAX_ELEMENT_NAME_LENGTH,
|
|
60
61
|
MAX_ENVELOPE_ID_LENGTH,
|
|
61
62
|
MAX_ENVELOPE_TYPE_LENGTH,
|
|
63
|
+
MAX_FRAME_ORIGINS,
|
|
62
64
|
MAX_MEDIA_ORIGINS,
|
|
63
65
|
OTP_OPS,
|
|
64
66
|
PAGE_LOCATION_MAX_LENGTH,
|
|
@@ -242,7 +242,7 @@ interface BridgeRequestMap {
|
|
|
242
242
|
};
|
|
243
243
|
res: Record<string, never>;
|
|
244
244
|
};
|
|
245
|
-
/** 같은 탭에서 외부 https 사이트로 이동.
|
|
245
|
+
/** 같은 탭에서 외부 https 사이트로 이동. 이동 여부는 호스트가 정한다(거절할 수 있다). */
|
|
246
246
|
navigateExternal: {
|
|
247
247
|
req: {
|
|
248
248
|
readonly url: string;
|
|
@@ -242,7 +242,7 @@ interface BridgeRequestMap {
|
|
|
242
242
|
};
|
|
243
243
|
res: Record<string, never>;
|
|
244
244
|
};
|
|
245
|
-
/** 같은 탭에서 외부 https 사이트로 이동.
|
|
245
|
+
/** 같은 탭에서 외부 https 사이트로 이동. 이동 여부는 호스트가 정한다(거절할 수 있다). */
|
|
246
246
|
navigateExternal: {
|
|
247
247
|
req: {
|
|
248
248
|
readonly url: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bstage-sdk/bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "bstage SDK bridge — isolated template iframe protocol, host policy and frame client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"tsup": "^8.0.0",
|
|
64
64
|
"typescript": "^5.5.0",
|
|
65
|
-
"@bstage-sdk/design": "0.
|
|
65
|
+
"@bstage-sdk/design": "0.18.0"
|
|
66
66
|
},
|
|
67
67
|
"license": "MIT",
|
|
68
68
|
"scripts": {
|