Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:html_safe is NOT HTML save #109

Closed
kaaboaye opened this issue Apr 22, 2020 · 0 comments
Closed

:html_safe is NOT HTML save #109

kaaboaye opened this issue Apr 22, 2020 · 0 comments

Comments

@kaaboaye
Copy link

kaaboaye commented Apr 22, 2020

If json contains the following string <!-- anything here <script> it will comment out the rest of HTML braking the website.

The problem?

Adding the :html_safe to encode/2 doesn't escape this sequence.

https://hexdocs.pm/jason/Jason.html#encode/2

Reproduction

<script>
const a = "<!-- <script>"
</script>
<h1>This is commented out</h1>

Why is that?

Because of the HTML Spec https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant