Skip to content

Commit e2b503f

Browse files
committed
Escape name in html for iframe in share modal
1 parent 72f4a14 commit e2b503f

File tree

1 file changed

+4
-9
lines changed
  • packages/app/src/app/pages/common/Modals/ShareModal

1 file changed

+4
-9
lines changed

packages/app/src/app/pages/common/Modals/ShareModal/getCode.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import {
66
sandboxUrl,
77
embedUrl,
88
} from '@codesandbox/common/lib/utils/url-generator';
9+
import { escapeHtml } from 'app/utils/escape';
910

10-
export const BUTTON_URL = `${
11-
process.env.CODESANDBOX_HOST
12-
}/static/img/play-codesandbox.svg`;
11+
export const BUTTON_URL = `${process.env.CODESANDBOX_HOST}/static/img/play-codesandbox.svg`;
1312

1413
export const VIEW_OPTIONS = ['Editor + Preview', 'Preview', 'Editor'];
1514

@@ -65,12 +64,8 @@ export const getEmbedUrl = (sandbox, mainModule, state) =>
6564
getOptionsUrl(sandbox, mainModule, state);
6665

6766
export const getIframeScript = (sandbox, mainModule, state) =>
68-
`<iframe src="${getEmbedUrl(
69-
sandbox,
70-
mainModule,
71-
state
72-
)}" title="${getSandboxName(
73-
sandbox
67+
`<iframe src="${getEmbedUrl(sandbox, mainModule, state)}" title="${escapeHtml(
68+
getSandboxName(sandbox)
7469
)}" allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>`;
7570

7671
// eslint-disable-next-line

0 commit comments

Comments
 (0)