Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8668455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:13:04+00:00 2026-06-12T18:13:04+00:00

I am trying to use the Security component in order to avoid CSRF attacks

  • 0

I am trying to use the Security component in order to avoid CSRF attacks and if i use the formHelper to create the ticket just using a postLink, like this, it fails:

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

I am not sure if this is possible or CakePHP just allow this feature using the create() and end() methods of formHelper.

CakePHP documentation only says that is is compulsory to use the formHelper but it doesn’t specify much more.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:13:05+00:00Added an answer on June 12, 2026 at 6:13 pm

    When you have the Security component enabled and you use the FormHelper methods for all forms you do not have to worry about this. You also do not have to configure anything. It works out of the box.

    For CSRF you can use the following options:

    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.
    

    If you have everything ON you should see the CSRF tokens in the html of the form. You can set any additional options you like but it will pretty much work out of the box for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use a authenticate with an Active directory using Spring Security 3.1.
Trying to use security features and create Forms Authentication in my MVC3 application I
I am trying to use Symfony 2 security component, but I have a problem
Hi ive been trying to use System.Security.Cryptography to encrypt and decrypt a file but
I am trying to use Bouncy Castle as a security provider in a Maven
I am trying to implement web services that use different security mechanisms to do
I am trying to use PreAuthFilter (for Siteminder) with Spring Security 3.0. <http use-expressions=true>
I'm trying to use CommonCrypto to generate keys using PBKDF2 but I can't seem
I am trying to throw exceptions and I am doing the following: use Symfony\Component\HttpKernel\Exception\HttpNotFoundException;
I'm trying to use some code like is seen on another questions answer: https://stackoverflow.com/a/621849/1044984

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.