确保在数据库中创建记录


PhalconPHP - Securing creating record in database

我有一个关于如何创建用户传递的表单数据的安全记录的问题。是:

$account = new Accounts();
$account->email = $parserData['email'];
$account->password = $parserData['password'];
$account->save();

是安全的还是我应该自己验证(或以某种方式使用绑定)每一块数据?我找不到关于sql注入在模型教程中创建记录的答案,可在phalcon的网站上参考。

SQL注入被阻止在核心,你应该哈希密码虽然和(可选)检查如果'email'和'password'是字符串,因为XSS,我打开了一个问题在这个前一段时间:https://github.com/phalcon/cphalcon/issues/2756

参见:https://docs.phalconphp.com/en/latest/reference/security.htmlhttp://phalcontip.com/discussion/24/harden-the-password-hashinghttps://docs.phalconphp.com/en/latest/reference/crypt.html

Phalcon使用准备好的语句,所以在分配变量时不需要担心正确转义。