Van*_*och 4 forms security cakephp
我有一个关于cakephp2表单安全性的问题.假设我们已启用安全组件,并且已经构建了用户身份验证,权限和产品管理系统.
我们需要创建一个Offer Offer功能,允许用户询问特定产品的报价.
用户已登录并单击"询问"并转至/ offer_requests/add/product_id
场景1:
在/Views/OfferRequests/add.ctp中:
<?php
echo $this->Form->create('OfferRequest');
echo $this->Form->input('user_id',
array('value' => $this->Session->read('Auth.User.id'),
'type' => 'hidden' ));
echo $this->Form->input('product_id');
echo $this->Form->input('quantity');
echo $this->Form->end(__('Submit'));
?>
Run Code Online (Sandbox Code Playgroud)
场景2:
在/Views/OfferRequests/add.ctp中:
<?php
echo $this->Form->create('OfferRequest');
echo $this->Form->input('product_id');
echo $this->Form->input('quantity');
echo $this->Form->end(__('Submit'));
?>
Run Code Online (Sandbox Code Playgroud)
在OfferRequestsController中添加():
<?php
$this->request->data['OfferRequest']['user_id'] = $this->Session->read('Auth.User.id');
?>
Run Code Online (Sandbox Code Playgroud)
我的问题是哪种情况更安全,例如反对以其他用户身份提出虚假请求.对于方案1,安全组件是否允许通过Firebug或其他软件操作输入值?