Disabled CSRF (ARCH7125)
هذا المحتوى غير متوفر بلغتك بعد.
Key php.security.disabled-csrf · Severity warning · Category security · CWE CWE-352
Disabling CSRF protection on a state-changing endpoint lets an attacker forge requests using the victim’s authenticated session.
Incorrect
Section titled “Incorrect”<?php// Laravel: route excluded from CSRF middlewareprotected $except = [ 'account/transfer', // all transfers unprotected];Correct
Section titled “Correct”<?php// Form includes a CSRF token, middleware verifies itRoute::post('/account/transfer', [TransferController::class, 'store']) ->middleware('web'); // VerifyCsrfToken activeKeep CSRF protection enabled on all state-changing routes; for genuine API endpoints use stateless auth (Bearer tokens) instead of disabling the token.