Skip to content

How does blueprint handle escaping html entities? #54

Answered by stephannv
robacarp asked this question in Q&A
Discussion options

You must be logged in to vote

Blueprint escapes all content and attributes when rendering.
On docs: https://stephannv.github.io/blueprint-docs/guides/safety
On code:

Tests: https://github.com/stephannv/blueprint/blob/main/spec/blueprint/html/safety_spec.cr

Example:

span { "<script>alert('hello')</script>" }

 input(class: "some-class\" onblur=\"alert('Attribute')")

Output:

<span>&lt;script&gt;alert(&#39;hello&#39;)&lt;/script&gt;</span>

<input class="some-class&quot; onblur=&quot;alert(&#39;Attribute&#39;)">

In the next releases I will…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@robacarp
Comment options

@stephannv
Comment options

@stephannv
Comment options

@stephannv
Comment options

@robacarp
Comment options

Answer selected by robacarp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants