Skip to content

Commit

Permalink
security(ui): add sandbox attribute to iframe (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtobac authored Oct 7, 2024
1 parent 7c79633 commit 5e94f95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export const Iframe: Component<ComponentPropsWithoutRef<'iframe'> & { 'data-src'
srcDoc={code}
ref={iframeRef}
className="max-h-[450px] min-h-[450px] w-full overflow-y-auto rounded-lg border border-mushroom-800 bg-white dark:border-volcanic-300 dark:bg-volcanic-150"
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
// make sure the iframe is sandboxed to prevent any malicious scripts
// NEVER ALLOW `allow-scripts` and `allow-same-origin` together
sandbox="allow-scripts"
/>
</TabPanel>
<TabPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export const Iframe: Component<ComponentPropsWithoutRef<'iframe'> & { 'data-src'
srcDoc={code}
ref={iframeRef}
className="max-h-[450px] min-h-[450px] w-full overflow-y-auto rounded-lg border border-mushroom-800 bg-white"
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
// make sure the iframe is sandboxed to prevent any malicious scripts
// NEVER ALLOW `allow-scripts` and `allow-same-origin` together
sandbox="allow-scripts"
/>
</TabPanel>
<TabPanel>
Expand Down

0 comments on commit 5e94f95

Please sign in to comment.