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

[5.5] Blade: Make @json directive safe for use in HTML #21574

Merged
merged 3 commits into from
Oct 7, 2017

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