← PHP / Laravel · Contents

PHP-004 / Beginner

Rendering user data with Blade {!! !!}

A03:2021 Injection · CWE-79 Cross-site Scripting

Why is this a problem?

Unescaped output allows stored scripts to execute in another user's browser.

How to fix it

blade
<p>{{ $comment->body }}</p>  {{-- Automatic escaping --}}

Further reading