sandboxed iframe
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, typescript
Línea de trabajo
Locate the REPL result iframe entry point and the current srcdoc assignment; inspect how the parent and embedded page communicate. Use the linked playground-sandbox index.html and postMessage example as a reference, then verify that an embedded page cannot access parent data. Done means the reported parent.document access is prevented while the REPL still renders user HTML.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
hello,
Thanks for the great project. I used it as a base for Vue support on my project (LiveCodes - an open-source client-side code playground for 80+ frameworks/languages).
https://livecodes.io/?template=vue
I noticed that the result page of the repl is displayed in a sandboxed iframe. However, the code is sent to the iframe by setting srcdoc. This does not set a different origin for the iframe.
Note, however, that you need to be very careful when dealing with framed content that comes from the same origin as the parent. If a page on https://example.com/ frames another page on the same origin with a sandbox that includes both the allow-same-origin and allow-scripts flags, then the framed page can reach up into the parent, and remove the sandbox attribute entirely.
https://web.dev/articles/sandboxed-iframes
For example, if I run this in the repl, it works!
parent.document.body.innerHTML = 'Hacked!'
If we are able to access the repl parent (embedding pages on user websites), then we can read cookies, localStorage and all sorts of bad things. I think this is a major security concern.
I suggest to set the iframe.src to a page on a different origin and then send the html using postMessage.
This is an example repo, where I added a simple webpage that can be set as iframe.src and would accept the HTML sent to it from its parent and document.writes it to itself. I published that to npm so that it can be hosted (with versions) on CDNs. It can be used as this URL: https://unpkg.com/@live-codes/[email protected]/index.html.
That was just an example. However, if you agree with that, I would be happy to send a PR for this change.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.1k
- Forks
- 222
- Merge medio
- 2 h 10 min
- PR fusionados (30 d)
- 1
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de vuejs/repl
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Feat request: export injectKeyPropsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
-
using Sandbox with clearConsole false,there would be a warning message on the browser's consoleAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Todos los issues de vuejs/repl
Issues similares
-
bot:ai-assisted component:platform-js status:untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
midnightntwrk/platform-js#69 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Picolab/pico-engine#668 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
ai-driven-qa bug claude Cosmetic
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
needs verification
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 13 días