Skip to content

Commit

Permalink
fix: disallow network requests etc. in sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
j4k0xb committed May 18, 2024
1 parent d6e1ce0 commit 94050d2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/playground/src/sandbox.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import Sandybox from 'sandybox';

const sandbox = await Sandybox.create();
const iframe = document.querySelector<HTMLIFrameElement>('.sandybox');
iframe?.contentDocument?.head.insertAdjacentHTML(
'afterbegin',
`<meta http-equiv="Content-Security-Policy" content="default-src 'none';">`,
);
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

export async function evalCode(code: string) {
Expand Down

0 comments on commit 94050d2

Please sign in to comment.