【发布时间】:2016-05-26 14:07:57
【问题描述】:
在我的 Symfony 项目中,我使用的是 FOS 用户包。
在我的 secutity.yml 中,我有这个以便使用 bcrypt 编码器:
security:
# FOS UserBundle needles
encoders:
Symfony\Component\Security\Core\User\User: bcrypt
MyNamespace\MyBundle\Entity\User: bcrypt
FOS\UserBundle\Model\UserInterface: bcrypt
我以这样的嵌入形式调用 fos 用户注册表:
$builder
->add('contactPhone')
->add('contactMobilePhone')
->add('user', 'fos_user_registration', array(
'label' => false,
))
但是当我提交表单时,我可以在网络控制台浏览器中看到我的密码是纯文本的,每个人都可以使用它们。
所以我可以在控制台浏览器中恢复我的 POST 请求的所有数据:
my_form[user][email]=test@test.com
my_form[contactPhone]=0404040404
my_form[contactMobilePhone]=0606060606
my_form[user][username]=test
my_form[user][plainPassword][first]=test// 第一个密码输入
my_form[user][plainPassword][second]=test// 验证
my_form[save]// 提交 my_form[_token_consumer]=// 不用见他
您可以理解它不安全。我在提交表单时需要对密码进行编码,以免所有人看到它们。
请注意,当我使用 FOSUserBundle 用户登录表单登录自己时,也会发生同样的事情。
【问题讨论】:
标签: php symfony security fosuserbundle encoder