質問

CSRF攻撃を回避するために Security コンポーネントを使用しようとしています。

<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $user['User']['id']),  array('class' => 'button mini'), __('Are you sure?', $user['User']['id'])); ?>
.

これが可能か、CakePhpがFormHelperのcreate()およびend()メソッドを使用してこの機能を許可するだけではないかどうかはわかりません。

href="http://book.cakephp.org/2.0/en/core-libraries/components/cecrurity-component.html"rel="nofollow"> CakePhp Documentation フォームヘルパーを使用するのは必須ですが、もっとはるかには指定されていません。

役に立ちましたか?

解決

セキュリティコンポーネントが有効になっていて、これを心配する必要はありません。また、何も設定する必要はありません。箱から出しています。

CSRFの場合次のオプションを使用できます。

property SecurityComponent::$csrfCheck
Whether to use CSRF protected forms. Set to false to disable CSRF protection on forms.

property SecurityComponent::$csrfExpires
The duration from when a CSRF token is created that it will expire on. Each form/page request will generate a new token that can only be submitted once unless it expires. Can be any value compatible with strtotime(). The default is +30 minutes.

property SecurityComponent::$csrfUseOnce
Controls whether or not CSRF tokens are use and burn. Set to false to not generate new tokens on each request. One token will be reused until it expires. This reduces the chances of users getting invalid requests because of token consumption. It has the side effect of making CSRF less secure, as tokens are reusable.
.

あなたがすべてのものを持っているならば、フォームのHTMLのCSRFトークンを見るべきです。あなたはあなたが好きな追加のオプションを設定することができますが、それはあなたのために箱からかなり多くの作業をします。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top