Performance: Security best practices
Security best practices impact page trustworthiness and user data safety, indirectly affecting user experience and site reputation.
Jump into concepts and practice - no test required
$user = DB::select('SELECT * FROM users WHERE email = ?', [$email]);$user = DB::select("SELECT * FROM users WHERE email = '" . $email . "'");
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Unsafe SQL queries | N/A | N/A | N/A | [X] Bad |
| Parameterized queries | N/A | N/A | N/A | [OK] Good |
| Weak password hashing | N/A | N/A | N/A | [X] Bad |
| Strong password hashing | N/A | N/A | N/A | [OK] Good |
| Unescaped output | Potentially many | Many on script injection | High due to script execution | [X] Bad |
| Escaped output | Minimal | Minimal | Low | [OK] Good |
Route::middleware(['auth'])->group(function () {
Route::get('/dashboard', function () {
return 'Welcome to your dashboard';
});
});
What will happen if a guest (not logged in) tries to access /dashboard?public function store(Request $request) {
$data = $request->validate([
'email' => 'required|email',
'password' => 'required|min:8'
]);
User::create($data);
}
What is the main security issue here?