<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Responsible use of the $_REQUEST variable.</title>
	<atom:link href="http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/feed/" rel="self" type="application/rss+xml" />
	<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/</link>
	<description>Brian Moon, of dealnews.com, shares what he knows (and learns) about PHP, MySQL and other stuff</description>
	<pubDate>Mon, 12 May 2008 22:16:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
		<item>
		<title>By: Sicherheit in PHP - Seite 4 - PHP @ tutorials.de: Forum, Tutorial, Anleitung, Schulung &#38; Hilfe</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-18417</link>
		<dc:creator>Sicherheit in PHP - Seite 4 - PHP @ tutorials.de: Forum, Tutorial, Anleitung, Schulung &#38; Hilfe</dc:creator>
		<pubDate>Sat, 29 Mar 2008 14:27:53 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-18417</guid>
		<description>[...] Sicherheit in PHP     Responsible use of the $_REQUEST variable  Ein netter Artikel über die kleinen Gefahren von _REQUEST.  Die Kommentare sind ebenfalls zu [...]</description>
		<content:encoded><![CDATA[<p>[...] Sicherheit in PHP     Responsible use of the $_REQUEST variable  Ein netter Artikel über die kleinen Gefahren von _REQUEST.  Die Kommentare sind ebenfalls zu [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: developercast.com &#187; Brian Moon&#8217;s Blog: Responsible use of the $_REQUEST variable</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-17041</link>
		<dc:creator>developercast.com &#187; Brian Moon&#8217;s Blog: Responsible use of the $_REQUEST variable</dc:creator>
		<pubDate>Tue, 22 Jan 2008 16:15:29 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-17041</guid>
		<description>[...] one of his recent blog entries, Brian Moon takes a look at what he considers the &#8220;proper use&#8221; of the PHP superglobal [...]</description>
		<content:encoded><![CDATA[<p>[...] one of his recent blog entries, Brian Moon takes a look at what he considers the &#8220;proper use&#8221; of the PHP superglobal [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHPDeveloper.org</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-17037</link>
		<dc:creator>PHPDeveloper.org</dc:creator>
		<pubDate>Tue, 22 Jan 2008 13:46:24 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-17037</guid>
		<description>&lt;strong&gt;Brian Moon's Blog: Responsible use of the $_REQUEST variable&lt;/strong&gt;


In one of his recent blog entries, Brian Moon takes a ...</description>
		<content:encoded><![CDATA[<p><strong>Brian Moon&#8217;s Blog: Responsible use of the $_REQUEST variable</strong></p>
<p>In one of his recent blog entries, Brian Moon takes a &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Utiliser $_REQUEST intelligemment</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-17003</link>
		<dc:creator>Utiliser $_REQUEST intelligemment</dc:creator>
		<pubDate>Sun, 20 Jan 2008 15:54:09 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-17003</guid>
		<description>[...] &#160;Responsible use of the $_REQUEST variable. (0 visite) [...]</description>
		<content:encoded><![CDATA[<p>[...] &nbsp;Responsible use of the $_REQUEST variable. (0 visite) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JordanC</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16968</link>
		<dc:creator>JordanC</dc:creator>
		<pubDate>Fri, 18 Jan 2008 15:52:47 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16968</guid>
		<description>Just like to say that also, automatically the use of $_GET isn't insecure with regards to $_POST which poses a slight advantage due to it's more "concealed" nature, but nevertheless is still as exploitable. As per the HTTP definition, GET is a useful tool for when you are passing parameters to a particular page once the user has been authenticated - to fuck around with hitten form elements when this can easily be cleansed is just ignant. 

There are so many incorrect assumptions, and many incorrect practices when cleansing GET also.

1) Don't remove characters like %$&#38;^&#38;$, you escape them to their ASCII character codes.
2) GET requests aren't evil, and providing you've got full control of the HTTP request and know what data was passed from where, you can easily ascertain if there are any errors.
3) GET and POST exist for specific reasons. With merging GET requests with POST requests, you are able to use a central way to access elements that are the same, but also you then give precedence to whichever is prepended or appended to the array. You won't know which came from where, and if the key in GET exists already then it'll essentially be an intersect; as per php.net/array_merge -- "If the input arrays have the same string keys, then the later value for that key will overwrite the previous one.".


If you want to use POST, then use POST as it was most originally intended in RFC , but essentially derived to the use of forms: 

" The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:"

      - Annotation of existing resources;

      - Posting a message to a bulletin board, newsgroup, mailing list,
        or similar group of articles;

      - Providing a block of data, such as the result of submitting a
        form, to a data-handling process;

      - Extending a database through an append operation.

The GET request is a different method, used for a different purpose and is distinctly required and shouldn't just be noted as "insecure" due to the fact that people are able to provide simplistic SQL injection or old-school "shell injection" or XSS -- all it needs to be fixed is sane code and logical checks on GET requests. Again, as per the HTTP 1.1 definition:

"   The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the entity be transferred only under the circumstances described by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already held by the client."

Not being offensive, just saying that this isn't neccesarily a great option or practice you can use to minimise security issues when you're essentially obfuscating things more than you need to.</description>
		<content:encoded><![CDATA[<p>Just like to say that also, automatically the use of $_GET isn&#8217;t insecure with regards to $_POST which poses a slight advantage due to it&#8217;s more &#8220;concealed&#8221; nature, but nevertheless is still as exploitable. As per the HTTP definition, GET is a useful tool for when you are passing parameters to a particular page once the user has been authenticated - to fuck around with hitten form elements when this can easily be cleansed is just ignant. </p>
<p>There are so many incorrect assumptions, and many incorrect practices when cleansing GET also.</p>
<p>1) Don&#8217;t remove characters like %$&amp;^&amp;$, you escape them to their ASCII character codes.<br />
2) GET requests aren&#8217;t evil, and providing you&#8217;ve got full control of the HTTP request and know what data was passed from where, you can easily ascertain if there are any errors.<br />
3) GET and POST exist for specific reasons. With merging GET requests with POST requests, you are able to use a central way to access elements that are the same, but also you then give precedence to whichever is prepended or appended to the array. You won&#8217;t know which came from where, and if the key in GET exists already then it&#8217;ll essentially be an intersect; as per php.net/array_merge &#8212; &#8220;If the input arrays have the same string keys, then the later value for that key will overwrite the previous one.&#8221;.</p>
<p>If you want to use POST, then use POST as it was most originally intended in RFC , but essentially derived to the use of forms: </p>
<p>&#8221; The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:&#8221;</p>
<p>      - Annotation of existing resources;</p>
<p>      - Posting a message to a bulletin board, newsgroup, mailing list,<br />
        or similar group of articles;</p>
<p>      - Providing a block of data, such as the result of submitting a<br />
        form, to a data-handling process;</p>
<p>      - Extending a database through an append operation.</p>
<p>The GET request is a different method, used for a different purpose and is distinctly required and shouldn&#8217;t just be noted as &#8220;insecure&#8221; due to the fact that people are able to provide simplistic SQL injection or old-school &#8220;shell injection&#8221; or XSS &#8212; all it needs to be fixed is sane code and logical checks on GET requests. Again, as per the HTTP 1.1 definition:</p>
<p>&#8221;   The semantics of the GET method change to a &#8220;conditional GET&#8221; if the request message includes an If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the entity be transferred only under the circumstances described by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already held by the client.&#8221;</p>
<p>Not being offensive, just saying that this isn&#8217;t neccesarily a great option or practice you can use to minimise security issues when you&#8217;re essentially obfuscating things more than you need to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JordanC</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16966</link>
		<dc:creator>JordanC</dc:creator>
		<pubDate>Fri, 18 Jan 2008 15:38:04 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16966</guid>
		<description>Don't forget that when you use [] in POST or GET, PHP will create an array. Also, count($_POST) is quicker.</description>
		<content:encoded><![CDATA[<p>Don&#8217;t forget that when you use [] in POST or GET, PHP will create an array. Also, count($_POST) is quicker.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: munim</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16965</link>
		<dc:creator>munim</dc:creator>
		<pubDate>Fri, 18 Jan 2008 13:08:18 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16965</guid>
		<description>hmm.. i never thought about this.
my advice is.. you use get and post in the places where they are appropriate but remember what you have used... and use $_GET or $_POST. also you should always sanitise inputs...</description>
		<content:encoded><![CDATA[<p>hmm.. i never thought about this.<br />
my advice is.. you use get and post in the places where they are appropriate but remember what you have used&#8230; and use $_GET or $_POST. also you should always sanitise inputs&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EPE</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16961</link>
		<dc:creator>EPE</dc:creator>
		<pubDate>Fri, 18 Jan 2008 08:01:36 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16961</guid>
		<description>To Dashifen:

No, you are not confused; but most of the rest of the world is. Unfortunately, to many people cannot tell the SEMANTIC difference between a GET and a POST request: I have seen sites developed entirely using POST and an unique URL (this is quite common among java developers), and I have seen sites where GET requests would delete data.</description>
		<content:encoded><![CDATA[<p>To Dashifen:</p>
<p>No, you are not confused; but most of the rest of the world is. Unfortunately, to many people cannot tell the SEMANTIC difference between a GET and a POST request: I have seen sites developed entirely using POST and an unique URL (this is quite common among java developers), and I have seen sites where GET requests would delete data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lars Strojny</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16959</link>
		<dc:creator>Lars Strojny</dc:creator>
		<pubDate>Fri, 18 Jan 2008 00:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16959</guid>
		<description>Another way is to beat this with configuration. Assuming you have controllers, just require that every controller has an configuration entry which HTTP methods are allowed to use with this controller. /entries/1 =&#62; only GET, /entries/add =&#62; only POST, /entries/delete =&#62; only POST. No, you should not use _REQUEST then, but you can have something like a getParam()-method which accesses both _POST and _GET.</description>
		<content:encoded><![CDATA[<p>Another way is to beat this with configuration. Assuming you have controllers, just require that every controller has an configuration entry which HTTP methods are allowed to use with this controller. /entries/1 =&gt; only GET, /entries/add =&gt; only POST, /entries/delete =&gt; only POST. No, you should not use _REQUEST then, but you can have something like a getParam()-method which accesses both _POST and _GET.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebs</title>
		<link>http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16958</link>
		<dc:creator>Sebs</dc:creator>
		<pubDate>Thu, 17 Jan 2008 22:41:19 +0000</pubDate>
		<guid isPermaLink="false">http://doughboy.wordpress.com/2008/01/17/responsible-use-of-the-_request-variable/#comment-16958</guid>
		<description>used _REQUEST and died in pain. Never touched it again ;)</description>
		<content:encoded><![CDATA[<p>used _REQUEST and died in pain. Never touched it again ;)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
