Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
When 'postMessage'-ing code to sandboxed iframe, can we set targetOrigin to anything other than '*'?

I have a use case where I need to accept javascript from users of my app and evaluate it using eval. I figured the 'safe' way would be to use web workers inside of a sandboxed iframe.

I found this article in my research, following which I was able to successfully send code to my web worker and get the eval response back to my main app.

targetOrigin while sending code to the iframe was * (because I don't have allow-same-origin and the iframe's window.origin would be null)."

I was wondering if there's any other alternative rather than enabling the allow-same-origin on my iframe OR setting * as both of them pose some sort of security issues which more or less mitigate the advantages of using the sandboxed iframe in first place (from what I read online).

Thank you

PS. I did find other SO threads that discuss this issue but none were addressed/came to a conclusion so was looking for a fresh perspective. I am pasting the URL below for the interested members.

javascript - postMessage to sandboxed iframe, why is recipient window origin null?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda