-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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.4] Escape inline sections #17453
[5.4] Escape inline sections #17453
Conversation
Nice one. @taylorotwell This should probably be mentioned in the 5.4 upgrade guide, right? |
This broke a couple of sections for me - something in the upgrade guide would be awesome. |
@maddhatter it's easier to notice HTML being escaped than the other way around. |
@sileence Yeah, I totally get the motivation for the change and agree with it. It just took awhile of working my way through the all the Blade classes/methods to find what had changed so I could fix my code. |
I'm having an issue with this change. I was using the method $view = \View::make('layout');
$view->getFactory()->inject('section', $anotherView->render()); I can't do this anymore, as now the injected view gets encoded by $view = \View::make('layout');
$view->getFactory()->startSection('section');
echo $anotherView->render();
$view->getFactory()->stopSection(); I don't know what was the exact purpose of the method public function inject($section, $content)
{
return $this->extendSection($section, $content);
} If that's ok, I can make a PR with this change. |
The correct work around is to just use the HtmlString class (at least, the best way I can think of). |
|
Nice one Graham, I'll use that, thanks! 👍 |
We probably need better docs for this tbh. :) |
Subtle but important change (imho).
This is a possible XSS attack:
@section('title', '</title><script>alert("hi")</script>')
Of course the problem there is evident, but it is less evident if you have something like:
@section('title', $user->username)
or@section('title', $userPost->title)
Using:
Makes it evident that the content is not escaped, but
@section('title', $post->title)
doesn't.