Skip to content

Conversation

@franzliedke
Copy link
Contributor

As suggested by @ryantology here, the @json directive should by default use encoding options that are safe to use in HTML output.

We encountered a similar problem recently in Flarum that we fixed in a similar, albeit incomplete way. Once we upgrade to Laravel 5.5, we can then use the @json directive.

Technically, this is slightly breaking backwards-compatible, but doing so for the XSS-safety of the people, so I hope this is okay.

This also adds test and slightly prettifies the compiled output. :)

franzliedke referenced this pull request in flarum/framework Oct 7, 2017
<\/script> tags in post content would sometimes be recognized as
actually ending the script tag, even when escaped (not exactly sure
why). This is fixed by encoding the < > characters in unicode.
@taylorotwell taylorotwell merged commit a82af39 into laravel:5.5 Oct 7, 2017
@franzliedke franzliedke deleted the blade-json-secure branch June 9, 2021 20:32
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

Successfully merging this pull request may close these issues.

2 participants