Monday, October 4, 2010

Re: Security: Token is not accepted anymore when creating/updating user

If you get stuck and just want to move past this problem, you side step the Security component on one or more specific actions:

if ($this->action == '<-action_name->'):
$this->Security->validatePost = false;
endif;

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 4 Oct 2010, at 11:40, Joshua Muheim wrote:

> Thanks for your hint, Jeremy. I figured out that I have a field too
> few in "counting in", namely a "Delete image" checkbox that is created
> by the MeioUpload component... Let's see how to solve this...
>
> On Mon, Oct 4, 2010 at 11:56 AM, Jeremy Burns | Class Outfit
> <jeremyburns@classoutfit.com> wrote:
>> Not sure I can provide a definitive answer here, but perhaps I can start you off.
>>
>> You must use the Form helper to create the form and all of its inputs. The Security component counts them in (when the form is created) and counts them out again (when the form is submitted). If what comes out does not match *exactly* what went in, the Security component does what it is supposed to do, which is assume that a user has hacked the form; it black holes it to the WSOD.
>>
>> Are you using any client side script to adjust the contents of the form, even hiding inputs?
>>
>> Jeremy Burns
>> Class Outfit
>>
>> jeremyburns@classoutfit.com
>> http://www.classoutfit.com
>>
>> On 4 Oct 2010, at 10:49, psybear83 wrote:
>>
>>> Good new week, everybody.
>>>
>>> I just noticed that I can't create/updated users anymore in my app.
>>> I'm always getting a white screen of death when trying it. I tracked
>>> it down to the security component that checks the submitted form data
>>> (_validatePost()), and the token submitted through the form doesn't
>>> equal the check value.
>>>
>>> I'm trying to track down where's the problem (it does only happen when
>>> creating/updating a user; all the other models work), but it's rather
>>> difficult for me because I'm new to the check/token-paradigm...
>>>
>>> So maybe someone could point me to an explanation of this? The source
>>> code of CakePHP isn't too well documented on this topic, sadly.
>>>
>>> As far as I can see, a token is some sort of "validation value" that
>>> is generated when the form is displayed to the user. Then after
>>> submitting, the token is re-generated and compared to the submit
>>> token. But I don't really understand what's this useful for.
>>>
>>> Thanks a lot for help, I'm working on this issues for hours now and
>>> I'm quite lost at the moment.
>>> Joshua
>>>
>>> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>>>
>>> You received this message because you are subscribed to the Google Groups "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
>>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: