Yes, you're right. But not completely.
When you send Form data, you send token key with it.
If you create POST curl request with form data and without token, checkToken work.
In this example we expect the token form data with email, password and token CSRF :
/**
* @Post("/test")
*/
public function testAction() {
$this->view->disable();
$this->session->set('auth', 'yes');
if ($this->request->isPost()) {
echo "Check CSRF :", PHP_EOL;
var_dump($this->security->checkToken());
echo "POST dump :", PHP_EOL;
var_dump($this->request->getPost());
echo "Session dump :", PHP_EOL;
var_dump($_SESSION);
}
}
curl -d "[email protected]&password=12345678" https://localhost/admin/test
Check CSRF :
bool(false)
POST dump :
array(2) {
["email"]=>
string(17) "[email protected]"
["password"]=>
string(10) "12345678"
}
Session dump :
array(2) {
["privatRsc_started"]=>
bool(true)
["privatRscauth"]=>
string(3) "yes"
}
and without form data
curl -d "" https://localhost/admin/test
Check CSRF :
bool(true)
POST dump :
array(0) {
}
Session dump :
array(2) {
["privatRsc_started"]=>
bool(true)
["privatRscauth"]=>
string(3) "yes"
}
How dangerous is the query without data?