pds-dev-kit-web 2.2.319 → 2.2.320-trialguard.1

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.
@@ -0,0 +1,2 @@
1
+ export declare function sanitizeHtml(html?: string | null): string;
2
+ export default sanitizeHtml;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sanitizeHtml = void 0;
7
+ var dompurify_1 = __importDefault(require("dompurify"));
8
+ /**
9
+ * 판매자·작성자가 입력한 HTML(글 본문, 상품 설명, 강의·이벤트 소개, 정책 등)을
10
+ * 화면에 넣기 전에 실행되는 코드를 걸러낸다.
11
+ *
12
+ * - 제거: <script>, onerror 같은 on… 이벤트 속성, javascript: 주소, <object>, <embed>, iframe의 srcdoc
13
+ * - 유지: 글자 꾸밈, 표, 목록, 이미지, 링크(target 포함), class, style, data-* 속성
14
+ * - iframe(영상 삽입)은 유지하되 http(s) 주소만 허용한다.
15
+ */
16
+ var IFRAME_SRC_PATTERN = /^https?:\/\//i;
17
+ var isHookRegistered = false;
18
+ function registerHooks() {
19
+ if (isHookRegistered) {
20
+ return;
21
+ }
22
+ isHookRegistered = true;
23
+ dompurify_1.default.addHook('afterSanitizeAttributes', function (node) {
24
+ if (node.nodeName === 'IFRAME') {
25
+ var src = node.getAttribute('src') || '';
26
+ if (!IFRAME_SRC_PATTERN.test(src)) {
27
+ node.removeAttribute('src');
28
+ }
29
+ }
30
+ });
31
+ }
32
+ function sanitizeHtml(html) {
33
+ if (!html) {
34
+ return '';
35
+ }
36
+ registerHooks();
37
+ return dompurify_1.default.sanitize(html, {
38
+ ADD_TAGS: ['iframe'],
39
+ ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling', 'target'],
40
+ FORBID_TAGS: ['object', 'embed'],
41
+ FORBID_ATTR: ['srcdoc'],
42
+ // 본문 맨 앞의 <style>도 지워지지 않도록 body 기준으로 파싱한다.
43
+ FORCE_BODY: true
44
+ });
45
+ }
46
+ exports.sanitizeHtml = sanitizeHtml;
47
+ exports.default = sanitizeHtml;
@@ -11,6 +11,7 @@ exports.HTMLReader = void 0;
11
11
  var jsx_runtime_1 = require("react/jsx-runtime");
12
12
  var react_1 = require("react");
13
13
  var editorContentStyle_1 = require("../../../common/styles/editorContentStyle");
14
+ var sanitizeHtml_1 = require("../../../common/utils/sanitizeHtml");
14
15
  var styled_components_1 = __importDefault(require("styled-components"));
15
16
  function HTMLReader(_a) {
16
17
  var data = _a.data;
@@ -24,7 +25,7 @@ function HTMLReader(_a) {
24
25
  if (data && contentRef && contentRef.current) {
25
26
  var dom = new DOMParser();
26
27
  var doc = dom.parseFromString(data, 'text/html');
27
- contentRef.current.innerHTML = doc.documentElement.innerHTML;
28
+ contentRef.current.innerHTML = (0, sanitizeHtml_1.sanitizeHtml)(doc.documentElement.innerHTML);
28
29
  }
29
30
  }, [data]);
30
31
  return (0, jsx_runtime_1.jsx)(S_Content, { ref: contentRef });
@@ -59,6 +59,7 @@ var react_1 = require("react");
59
59
  var react_hook_form_1 = require("react-hook-form");
60
60
  var react_i18next_1 = require("react-i18next");
61
61
  var editorContentStyle_1 = require("../../../common/styles/editorContentStyle");
62
+ var sanitizeHtml_1 = require("../../../common/utils/sanitizeHtml");
62
63
  var components_1 = require("../../components");
63
64
  var HTMLReader_1 = require("../../components/RichTextEditor/HTMLReader");
64
65
  var index_1 = require("../../index");
@@ -174,7 +175,7 @@ function LocalizedContentModal(_a) {
174
175
  return null;
175
176
  return ((0, jsx_runtime_1.jsx)(DesktopBasicModal_1.DesktopBasicModal, __assign({ titleText: t('str_multilingual_settings'), btnMode: readonly ? 'mbtn_amount1' : 'mbtn_amount2', mBtn1Text: readonly ? t('str_confirm') : t('str_apply'), mBtn2Text: t('str_cancel'), size: size, onClickMBtn1: handleApply, onClickMBtn2: handleCancel }, { children: (0, jsx_runtime_1.jsxs)(react_hook_form_1.FormProvider, __assign({}, form, { children: [originalText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.TextLabel, { text: t('str_original_text'), wordBreak: "keep_all", styleTheme: "subTitleBold", colorTheme: "sysTextPrimary" }), originalFieldType === 'text' && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: textFieldLineType === 'tinyeditor' ? ((0, jsx_runtime_1.jsx)(S_ReadonlyContent, { children: (0, jsx_runtime_1.jsx)(HTMLReader_1.HTMLReader, { data: originalText }) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_d" }), (0, jsx_runtime_1.jsx)(components_1.TextLabel, { text: originalText, wordBreak: "keep_all", styleTheme: "body2Regular", colorTheme: "sysTextPrimary" })] })) })), originalFieldType === 'image' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_d" }), (0, jsx_runtime_1.jsx)(components_3.ImageView, __assign({ width: "responsive", height: "responsive" }, imageConfig, { src: originalText }))] })), (0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_f" }), (0, jsx_runtime_1.jsx)(components_2.Divider, {}), (0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_f" })] })), visibleLanguages === null || visibleLanguages === void 0 ? void 0 : visibleLanguages.map(function (languageCode, index) {
176
177
  return ((0, jsx_runtime_1.jsxs)(S_LanguageField, { children: [(0, jsx_runtime_1.jsx)(components_1.TextLabel, { text: t(LANGUAGE_I18N_KEYS[languageCode]), styleTheme: "subTitleBold", colorTheme: "sysTextPrimary" }), (0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_b" }), (0, jsx_runtime_1.jsx)(components_1.TextLabel, { text: t(LANGUAGE_DESC_TEXT_KEYS[languageCode]), styleTheme: "caption1Regular", colorTheme: "sysTextSecondary" }), (0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_b" }), originalFieldType === 'text' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [textFieldLineType === 'tinyeditor' && readonly && ((0, jsx_runtime_1.jsx)(AnnotationSheet_1.AnnotationSheet, __assign({ width: "100%", height: "240px", backgroundColorTheme: "base3", shapeType: "round", radius: 16, paddingTop: "spacing_d", paddingRight: "spacing_d", paddingBottom: "spacing_d", paddingLeft: "spacing_d" }, { children: (0, jsx_runtime_1.jsx)(S_ReadonlyContent, { dangerouslySetInnerHTML: {
177
- __html: (initialValues === null || initialValues === void 0 ? void 0 : initialValues[languageCode]) || ''
178
+ __html: (0, sanitizeHtml_1.sanitizeHtml)((initialValues === null || initialValues === void 0 ? void 0 : initialValues[languageCode]) || '')
178
179
  } }) }))), textFieldLineType === 'tinyeditor' && !readonly && ((0, jsx_runtime_1.jsx)(components_1.RichTextEditor, __assign({}, memoizedRichEditorConfig, { onChange: createHandleChange(languageCode), defaultText: initialValues === null || initialValues === void 0 ? void 0 : initialValues[languageCode], toolbar: (memoizedRichEditorConfig === null || memoizedRichEditorConfig === void 0 ? void 0 : memoizedRichEditorConfig.toolbar) || [
179
180
  'blocks',
180
181
  'bold italic underline strikethrough',
@@ -8,10 +8,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  var jsx_runtime_1 = require("react/jsx-runtime");
11
+ var sanitizeHtml_1 = require("../../../../../common/utils/sanitizeHtml");
11
12
  var styled_components_1 = __importDefault(require("styled-components"));
12
13
  function RichText(_a) {
13
14
  var text = _a.text;
14
- return (0, jsx_runtime_1.jsx)(S_RichText, { dangerouslySetInnerHTML: { __html: text } });
15
+ return (0, jsx_runtime_1.jsx)(S_RichText, { dangerouslySetInnerHTML: { __html: (0, sanitizeHtml_1.sanitizeHtml)(text) } });
15
16
  }
16
17
  var S_RichText = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n line-height: 1.5;\n text-align: left;\n white-space: pre-wrap;\n width: 100%;\n word-break: break-word;\n\n & pre {\n white-space: pre-wrap;\n }\n\n /* \uC18C\uBE44 \uC571 GlobalStyle\uC758 span { font-weight/font-style: normal } \uC774 strong, em, h1~h6 \uC11C\uC2DD\uC744 \uB36E\uC9C0 \uC54A\uB3C4\uB85D \uBD80\uBAA8 \uAC12 \uC0C1\uC18D */\n span {\n font-style: inherit;\n font-weight: inherit;\n }\n\n div,\n p {\n overflow: hidden;\n }\n\n a {\n color: ", ";\n }\n\n img {\n max-width: 100%;\n height: auto;\n }\n\n figure {\n margin: 0;\n max-width: 100%;\n\n img {\n max-width: 100%;\n height: auto;\n }\n }\n\n blockquote {\n border-left: 4px solid ", ";\n margin: 4px;\n padding: 4px;\n\n p {\n font-style: oblique;\n margin: 0;\n }\n }\n\n iframe {\n border: none;\n }\n"], ["\n line-height: 1.5;\n text-align: left;\n white-space: pre-wrap;\n width: 100%;\n word-break: break-word;\n\n & pre {\n white-space: pre-wrap;\n }\n\n /* \uC18C\uBE44 \uC571 GlobalStyle\uC758 span { font-weight/font-style: normal } \uC774 strong, em, h1~h6 \uC11C\uC2DD\uC744 \uB36E\uC9C0 \uC54A\uB3C4\uB85D \uBD80\uBAA8 \uAC12 \uC0C1\uC18D */\n span {\n font-style: inherit;\n font-weight: inherit;\n }\n\n div,\n p {\n overflow: hidden;\n }\n\n a {\n color: ", ";\n }\n\n img {\n max-width: 100%;\n height: auto;\n }\n\n figure {\n margin: 0;\n max-width: 100%;\n\n img {\n max-width: 100%;\n height: auto;\n }\n }\n\n blockquote {\n border-left: 4px solid ", ";\n margin: 4px;\n padding: 4px;\n\n p {\n font-style: oblique;\n margin: 0;\n }\n }\n\n iframe {\n border: none;\n }\n"])), function (_a) {
17
18
  var theme = _a.theme;
@@ -51,6 +51,7 @@ var __rest = (this && this.__rest) || function (s, e) {
51
51
  Object.defineProperty(exports, "__esModule", { value: true });
52
52
  var jsx_runtime_1 = require("react/jsx-runtime");
53
53
  var react_1 = require("react");
54
+ var sanitizeHtml_1 = require("../../../../../common/utils/sanitizeHtml");
54
55
  var styled_components_1 = __importStar(require("styled-components"));
55
56
  var dynamicLayoutContext_1 = require("../../../dynamicLayoutContext");
56
57
  var pdsOriginal_1 = require("../../pdsOriginal");
@@ -180,7 +181,7 @@ function HTMLReader(_a) {
180
181
  if (data && contentRef && contentRef.current) {
181
182
  var dom = new DOMParser();
182
183
  var doc = dom.parseFromString(data, 'text/html');
183
- contentRef.current.innerHTML = doc.documentElement.innerHTML;
184
+ contentRef.current.innerHTML = (0, sanitizeHtml_1.sanitizeHtml)(doc.documentElement.innerHTML);
184
185
  }
185
186
  }, [data]);
186
187
  return ((0, jsx_runtime_1.jsx)(S_Content, { ref: contentRef, styleTheme: styleTheme, colorTheme: colorTheme, color: color, textAlign: textAlign, isPreview: isPreview !== null && isPreview !== void 0 ? isPreview : mode === 'PREVIEW' }));
@@ -51,6 +51,7 @@ var __rest = (this && this.__rest) || function (s, e) {
51
51
  Object.defineProperty(exports, "__esModule", { value: true });
52
52
  var jsx_runtime_1 = require("react/jsx-runtime");
53
53
  var react_1 = require("react");
54
+ var sanitizeHtml_1 = require("../../../../../common/utils/sanitizeHtml");
54
55
  var styled_components_1 = __importStar(require("styled-components"));
55
56
  var dynamicLayoutContext_1 = require("../../../dynamicLayoutContext");
56
57
  var pdsOriginal_1 = require("../../pdsOriginal");
@@ -177,7 +178,7 @@ function HTMLReader(_a) {
177
178
  if (data && contentRef && contentRef.current) {
178
179
  var dom = new DOMParser();
179
180
  var doc = dom.parseFromString(data, 'text/html');
180
- contentRef.current.innerHTML = doc.documentElement.innerHTML;
181
+ contentRef.current.innerHTML = (0, sanitizeHtml_1.sanitizeHtml)(doc.documentElement.innerHTML);
181
182
  }
182
183
  }, [data]);
183
184
  return ((0, jsx_runtime_1.jsx)(S_Content, { ref: contentRef, styleTheme: styleTheme, colorTheme: colorTheme, color: color, textAlign: textAlign, isPreview: isPreview !== null && isPreview !== void 0 ? isPreview : mode === 'PREVIEW' }));
@@ -186,8 +186,9 @@ function Button(props) {
186
186
  return htmlRegex.test(text);
187
187
  };
188
188
  function domstringToPlain(domstring, ellipsis, useEnter) {
189
- var tempDivElement = document.createElement('div');
190
- tempDivElement.innerHTML = domstring;
189
+ // NOTE: DOMParser로 만든 문서는 이미지 로드·스크립트 실행이 일어나지 않아,
190
+ // 블록 텍스트에 숨긴 실행 코드(onerror 등)가 텍스트를 뽑는 과정에서 실행되지 않습니다.
191
+ var tempDivElement = new DOMParser().parseFromString(domstring, 'text/html').body;
191
192
  // 1. 제거하고 싶은 '비-텍스트' 태그들을 정의하고 모두 삭제합니다.
192
193
  var tagsToRemove = ['iframe', 'img', 'video', 'audio', 'script', 'style', 'canvas', 'svg'];
193
194
  tagsToRemove.forEach(function (tagName) {
@@ -4,5 +4,16 @@ interface EmbedCoreProps {
4
4
  embedCode: string;
5
5
  style: CSSProperties;
6
6
  }
7
+ /**
8
+ * 판매자가 넣은 Embed 코드를 회원 사이트의 화면(안내 배너 등)·쿠키·저장소에 닿지 않게 그린다.
9
+ *
10
+ * 1) iframe(다른 사이트 띄우기)만 있는 코드
11
+ * - 그 iframe을 직접 그린다. 다른 출처의 창이라 회원 사이트에 접근할 수 없고,
12
+ * 안쪽 사이트는 격리 전과 같은 sandbox 조건에서 쿠키·저장소를 쓸 수 있다.
13
+ * - http(s) 주소만, 회원 사이트 자기 주소는 제외한다(자기 사이트는 2번으로 보낸다).
14
+ * 2) 그 밖의 코드(스크립트 등)
15
+ * - srcDoc + allow-same-origin 없는 sandbox로 출처가 다른 격리 창(opaque origin)에서 실행한다.
16
+ * - 이 창 안에서는 쿠키·localStorage를 쓰는 부분과, 그것이 필요한 안쪽 사이트가 동작하지 않는다.
17
+ */
7
18
  declare const EmbedIframe: React.FC<EmbedCoreProps>;
8
19
  export default EmbedIframe;
@@ -10,36 +10,126 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  var jsx_runtime_1 = require("react/jsx-runtime");
11
11
  var react_1 = require("react");
12
12
  var styled_components_1 = __importDefault(require("styled-components"));
13
+ /**
14
+ * 격리 전 Embed에 쓰던 sandbox 값. 안쪽에 넣은 다른 사이트는 이 값을 그대로 물려받아 동작했다.
15
+ * iframe만 있는 Embed를 직접 그릴 때 같은 값을 걸어 격리 전과 같은 조건으로 띄운다.
16
+ */
17
+ var DIRECT_IFRAME_SANDBOX = 'allow-forms allow-modals allow-same-origin allow-popups allow-presentation allow-scripts allow-downloads allow-pointer-lock';
18
+ /** 스크립트가 든 Embed를 실행하는 격리 창의 sandbox 값(allow-same-origin 없음). */
19
+ var ISOLATED_SANDBOX = 'allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-downloads allow-pointer-lock';
20
+ /** 판매자 iframe에서 옮겨 오는 속성. 여기 없는 속성(srcdoc, on…, name 등)은 버린다. */
21
+ var DIRECT_IFRAME_ATTRS = [
22
+ 'src',
23
+ 'width',
24
+ 'height',
25
+ 'style',
26
+ 'title',
27
+ 'allow',
28
+ 'allowfullscreen',
29
+ 'frameborder',
30
+ 'scrolling',
31
+ 'referrerpolicy',
32
+ 'loading'
33
+ ];
34
+ /**
35
+ * 판매자가 넣은 Embed 코드를 회원 사이트의 화면(안내 배너 등)·쿠키·저장소에 닿지 않게 그린다.
36
+ *
37
+ * 1) iframe(다른 사이트 띄우기)만 있는 코드
38
+ * - 그 iframe을 직접 그린다. 다른 출처의 창이라 회원 사이트에 접근할 수 없고,
39
+ * 안쪽 사이트는 격리 전과 같은 sandbox 조건에서 쿠키·저장소를 쓸 수 있다.
40
+ * - http(s) 주소만, 회원 사이트 자기 주소는 제외한다(자기 사이트는 2번으로 보낸다).
41
+ * 2) 그 밖의 코드(스크립트 등)
42
+ * - srcDoc + allow-same-origin 없는 sandbox로 출처가 다른 격리 창(opaque origin)에서 실행한다.
43
+ * - 이 창 안에서는 쿠키·localStorage를 쓰는 부분과, 그것이 필요한 안쪽 사이트가 동작하지 않는다.
44
+ */
13
45
  var EmbedIframe = function (_a) {
14
46
  var embedCode = _a.embedCode, style = _a.style;
15
- var iframeRef = (0, react_1.useRef)(null);
47
+ var directIframes = (0, react_1.useMemo)(function () { return getDirectIframes(embedCode); }, [embedCode]);
16
48
  var embedHtml = (0, react_1.useMemo)(function () {
17
- return getHtmlCode(embedCode, style);
18
- }, [embedCode, style]);
49
+ return directIframes ? '' : getHtmlCode(embedCode, style);
50
+ }, [directIframes, embedCode, style]);
51
+ if (directIframes) {
52
+ return (0, jsx_runtime_1.jsx)(DirectIframes, { iframes: directIframes, style: style });
53
+ }
54
+ return ((0, jsx_runtime_1.jsx)(S_Iframe, { title: "cb-embed", srcDoc: embedHtml, allow: "accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-write;", sandbox: ISOLATED_SANDBOX }));
55
+ };
56
+ var DirectIframes = function (_a) {
57
+ var iframes = _a.iframes, style = _a.style;
58
+ var containerRef = (0, react_1.useRef)(null);
19
59
  (0, react_1.useLayoutEffect)(function () {
20
- var _a;
21
- if (!iframeRef.current) {
22
- return;
23
- }
24
- var iframeDoc = iframeRef.current.contentDocument || ((_a = iframeRef.current.contentWindow) === null || _a === void 0 ? void 0 : _a.document);
25
- if (!iframeDoc || !embedHtml) {
60
+ var container = containerRef.current;
61
+ if (!container) {
26
62
  return;
27
63
  }
28
- iframeDoc.open();
29
- iframeDoc.write(embedHtml);
30
- iframeDoc.close();
31
- }, [embedHtml]);
32
- return ((0, jsx_runtime_1.jsx)(S_Iframe, { ref: iframeRef, title: "cb-embed", allow: "accelerometer; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; clipboard-write;", sandbox: "allow-forms allow-modals allow-same-origin allow-popups allow-presentation allow-scripts allow-downloads allow-pointer-lock" }));
64
+ var elements = iframes.map(function (attrs) {
65
+ var iframe = document.createElement('iframe');
66
+ // sandbox는 주소를 불러오기 전에 걸어야 적용된다.
67
+ iframe.setAttribute('sandbox', DIRECT_IFRAME_SANDBOX);
68
+ attrs.forEach(function (_a) {
69
+ var name = _a[0], value = _a[1];
70
+ return iframe.setAttribute(name, value);
71
+ });
72
+ return iframe;
73
+ });
74
+ container.replaceChildren.apply(container, elements);
75
+ return function () {
76
+ container.replaceChildren();
77
+ };
78
+ }, [iframes]);
79
+ return (0, jsx_runtime_1.jsx)(S_DirectContainer, { ref: containerRef, style: style });
33
80
  };
81
+ function getDirectIframes(code) {
82
+ if (!code || typeof DOMParser === 'undefined') {
83
+ return null;
84
+ }
85
+ var _a = new DOMParser().parseFromString(code, 'text/html'), body = _a.body, head = _a.head;
86
+ if (head.childNodes.length > 0) {
87
+ return null;
88
+ }
89
+ // 주석과 공백만 건너뛰고, 나머지는 모두 iframe이어야 한다.
90
+ var nodes = Array.from(body.childNodes).filter(function (node) {
91
+ return node.nodeType !== Node.COMMENT_NODE &&
92
+ !(node.nodeType === Node.TEXT_NODE && !(node.textContent || '').trim());
93
+ });
94
+ var isIframeOnly = nodes.length > 0 &&
95
+ nodes.every(function (node) {
96
+ return node instanceof HTMLIFrameElement &&
97
+ node.childNodes.length === 0 &&
98
+ isAllowedDirectSrc(node.getAttribute('src') || '');
99
+ });
100
+ if (!isIframeOnly) {
101
+ return null;
102
+ }
103
+ return nodes.map(function (node) {
104
+ return DIRECT_IFRAME_ATTRS.filter(function (name) { return node.hasAttribute(name); }).map(function (name) { return [
105
+ name,
106
+ node.getAttribute(name) || ''
107
+ ]; });
108
+ });
109
+ }
110
+ function isAllowedDirectSrc(src) {
111
+ try {
112
+ var url = new URL(src.trim());
113
+ if (url.protocol !== 'https:' && url.protocol !== 'http:') {
114
+ return false;
115
+ }
116
+ return url.origin !== window.location.origin;
117
+ }
118
+ catch (_a) {
119
+ return false;
120
+ }
121
+ }
34
122
  var S_Iframe = styled_components_1.default.iframe(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: none;\n display: block;\n height: 100%;\n position: absolute;\n width: 100%;\n"], ["\n border: none;\n display: block;\n height: 100%;\n position: absolute;\n width: 100%;\n"])));
123
+ // 격리 창의 html/body와 같은 역할. 판매자 iframe 스타일(position: fixed 등)이 이 칸 밖으로 나가지 않게 가둔다.
124
+ var S_DirectContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n box-sizing: border-box;\n contain: layout paint;\n height: 100%;\n left: 0;\n margin: 0;\n overflow: auto;\n padding: 0;\n position: absolute;\n top: 0;\n width: 100%;\n"], ["\n box-sizing: border-box;\n contain: layout paint;\n height: 100%;\n left: 0;\n margin: 0;\n overflow: auto;\n padding: 0;\n position: absolute;\n top: 0;\n width: 100%;\n"])));
35
125
  function getHtmlCode(code, style) {
36
126
  var styleString = Object.entries(style).reduce(function (styleStr, _a) {
37
127
  var prop = _a[0], value = _a[1];
38
128
  var kebabProp = prop.replace(/([a-z0])([A-Z])/g, '$1-$2').toLowerCase();
39
129
  return "".concat(styleStr).concat(kebabProp, ": ").concat(value, ";");
40
130
  }, '');
41
- var html = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <base href=\"https://example.com/\">\n <meta charset=\"UTF-8\">\n <style>\n html, body {\n margin: 0;\n padding: 0;\n width: 100%;\n height: 100%;\n ".concat(styleString, "\n }\n\n body > div { \n flex-grow: 1;\n width: 100%;\n }\n </style>\n </head>\n <body>\n ").concat(code, "\n </body>\n </html>\n ");
131
+ var html = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <base href=\"https://example.com/\">\n <meta charset=\"UTF-8\">\n <style>\n html, body {\n margin: 0;\n padding: 0;\n width: 100%;\n height: 100%;\n ".concat(styleString, "\n }\n\n body > div {\n flex-grow: 1;\n width: 100%;\n }\n </style>\n </head>\n <body>\n ").concat(code, "\n </body>\n </html>\n ");
42
132
  return html;
43
133
  }
44
134
  exports.default = EmbedIframe;
45
- var templateObject_1;
135
+ var templateObject_1, templateObject_2;
@@ -239,8 +239,9 @@ var isRichText = function (text) {
239
239
  return htmlRegex.test(text);
240
240
  };
241
241
  function domstringToPlain(domstring, ellipsis, useEnter) {
242
- var tempDivElement = document.createElement('div');
243
- tempDivElement.innerHTML = domstring;
242
+ // NOTE: DOMParser로 만든 문서는 이미지 로드·스크립트 실행이 일어나지 않아,
243
+ // 블록 텍스트에 숨긴 실행 코드(onerror 등)가 텍스트를 뽑는 과정에서 실행되지 않습니다.
244
+ var tempDivElement = new DOMParser().parseFromString(domstring, 'text/html').body;
244
245
  // 1. 제거하고 싶은 '비-텍스트' 태그들을 정의하고 모두 삭제합니다.
245
246
  var tagsToRemove = ['iframe', 'img', 'video', 'audio', 'script', 'style', 'canvas', 'svg'];
246
247
  tagsToRemove.forEach(function (tagName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web",
3
- "version": "2.2.319",
3
+ "version": "2.2.320-trialguard.1",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -10,6 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@tinymce/tinymce-react": "^4.3.0",
13
+ "dompurify": "3.4.17",
13
14
  "i18next": "^21.3.2",
14
15
  "i18next-browser-languagedetector": "^6.1.2",
15
16
  "i18next-intervalplural-postprocessor": "^3.0.0",