Yii Framework Forum: Post Support For Action Parameter Binding - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Post Support For Action Parameter Binding Rate Topic: -----

#1 User is offline   nicocin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 29-November 10

Posted 18 January 2011 - 07:40 AM

Action Parameter Binding as implemented in CInlineAction currently only supports $_GET parameters, so parameters from POST requests won't be bound.

If CInlineAction would use CHttpRequest->getParam($name) instead of $_GET[$name]
in the run() method, it would support Action Parameter Binding in both GET and POST requests.

I would prefer that behavior.
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,747
  • Joined: 04-October 08
  • Location:DC, USA

Posted 18 January 2011 - 07:47 AM

Please also see this changeset which allows easier extension of CInlineAction: http://code.google.c.../detail?r=2888#
0

#3 User is offline   Woil 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 31-January 11

Posted 10 February 2011 - 01:12 PM

Why was it set to _GET instead of _REQUEST in the first place? Is there some security thing that I'm not understanding? (Or CHttpRequest->getParam($name))
0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 2,636
  • Joined: 17-January 09
  • Location:Russia

Posted 11 February 2011 - 11:41 AM

$_REQUEST includes $_GET, $_POST… and $_COOKIE. So yes, it's security thing: malicious user can override your variables by setting a cookie with the same name as your $_GET or $_POST parameter.
0

#5 User is offline   ScallioXTX 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 54
  • Joined: 14-September 09
  • Location:The Netherlands

Posted 09 July 2011 - 08:00 PM

_REQUEST is evil and should never have been in the language in the first place. It serves no useful purpose whatsoever (unless you consider making things more ambiguous and less secure useful).
Pure mathematics is, in its way, the poetry of logical ideas.
-- A. Einstein

Follow me on twitter, @scallioxtx
1

#6 User is offline   helmut 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 31-May 11

Posted 03 August 2011 - 02:48 PM

since version 1.1.7 this is now done via overriding getActionParams() from CController.

e.g. put this in components/Controller.php

public function getActionParams() { return array_merge($_GET, $_POST); }


to have both GET and POST parameters bind to action parameters.
2

#7 User is offline   ScallioXTX 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 54
  • Joined: 14-September 09
  • Location:The Netherlands

Posted 04 August 2011 - 06:05 AM

View Posthelmut, on 03 August 2011 - 02:48 PM, said:

since version 1.1.7 this is now done via overriding getActionParams() from CController.

e.g. put this in components/Controller.php

public function getActionParams() { return array_merge($_GET, $_POST); }


to have both GET and POST parameters bind to action parameters.


Security leaks FTW ! :blink:

There is a reason register_globals is deprecated; don't simulate it!
Pure mathematics is, in its way, the poetry of logical ideas.
-- A. Einstein

Follow me on twitter, @scallioxtx
2

#8 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 2,636
  • Joined: 17-January 09
  • Location:Russia

Posted 04 August 2011 - 08:24 AM

ScallioXTX, can you provide an example of why this is the security leak?
0

#9 User is offline   ScallioXTX 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 54
  • Joined: 14-September 09
  • Location:The Netherlands

Posted 12 August 2011 - 07:14 AM

View Postsamdark, on 04 August 2011 - 08:24 AM, said:

ScallioXTX, can you provide an example of why this is the security leak?


It may not be a very good example, but merging these two arrays makes it very easier to try and brute force stuff, as you could put the username and password in the URL and keep blasting. Creating POST requests is a little harder.

Plus I guess I'm not a fan of not knowing precisely where all my variables are coming from. It feels nasty.
Pure mathematics is, in its way, the poetry of logical ideas.
-- A. Einstein

Follow me on twitter, @scallioxtx
0

#10 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 2,636
  • Joined: 17-January 09
  • Location:Russia

Posted 12 August 2011 - 09:49 AM

ScallioXTX
Creating POST requests isn't harder at all. Ones who're breaking our apps are sometimes very clever guys.
0

#11 User is offline   wisp 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 192
  • Joined: 04-February 11

Posted 20 May 2012 - 12:28 PM

POST params should only be used to post data to the server, not to route a request. So the current behaviour is fine.
0

#12 User is offline   Ben 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 254
  • Joined: 15-March 09

Posted 23 May 2012 - 04:49 PM

Just rethinking this... Since you validate input before using it, does it really matter from which source it comes? I think I understand the different purposes of GET and POST data, but should our actions have to deal with that?
Don't like ads in my sig...
0

#13 User is offline   Ben 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 254
  • Joined: 15-March 09

Posted 28 April 2013 - 03:57 PM

Just for everyone who's interested in this feature request: Quite some time ago, I wrote a filter that allows pretty flexible configuration of action parameters. Have a look here: https://github.com/b...on-param-filter
Don't like ads in my sig...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users