You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module Main exposing (main)
import Html
import Html.Attributes
main =
Html.iframe
[ Html.Attributes.srcdoc """
<body><script>
alert('Hello from the iFrame')
window.parent.document.body.innerHTML = 'XSS in Elm packages?'
</script></body>
"""
]
[]
The text was updated successfully, but these errors were encountered:
Html.Attributes.sandbox* should probably be removed and in the virtual dom enforced to be present and empty in any iframe elements <iframe sandbox=""> so that all security restrictions apply and aren't overwritten by a random Html.Attributes.attribute.
The sandbox(mdn) attribute takes an allow-list of attributes that reduce the safety of the sandbox, so could definitely sanitize the attribute string to never contain "allow-scripts" for example, and if not present add it with some defaults for safety.
Both a bit tricky, 1) is a breaking change removing the attribute, and 2) is an implicit breaking change, the API doesn't change but the behavior of iframes does change and could break production apps that used iframes that contained scripts or other problematic elements for the package manager safety.
Using
iframe
s andsrcDoc
adding a random script tag to your application, from which you can access the parent window and do anything you want.You could publish a package that looked like a safe Html element and under the hood be doing pretty much anything with JS.
https://ellie-app.com/kfNPH9Y2qvqa1
The text was updated successfully, but these errors were encountered: