Challenge 3: Demonstrate Escaping — Possible Solution ==================================================================== // app/Http/Controllers/DemoController.php public function escapingDemo() { $dangerousValue = ''; return view('escaping-demo', ['value' => $dangerousValue]); }
{{ $value }}
{!! $value !!}
WHAT EACH VERSION ACTUALLY SENDS TO THE BROWSER -------------------------------------------------- {{ $value }} — the escaped version — sends this literal HTML source:<script>alert("xss")</script>
The browser displays this as plain, inert TEXT on the page: It reads like a script tag, but it is NOT one — Blade converted the angle brackets and quotes into HTML entities before sending the response, so the browser's HTML parser never recognizes it as a real The browser's HTML parser sees a genuine