Skip to content

Commit

Permalink
fix: prevent XSS (#486)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
r0hanSH and antfu committed Feb 18, 2022
1 parent aae017d commit 92db175
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/client/iframes/monaco/index.ts
Expand Up @@ -135,6 +135,8 @@ async function start() {
window.addEventListener('message', (payload) => {
if (payload.source === window)
return
if (payload.origin !== location.origin)
return
if (typeof payload.data !== 'string')
return
const { type, data } = JSON.parse(payload.data)
Expand Down

0 comments on commit 92db175

Please sign in to comment.