<?xml version="1.0" encoding="UTF-7"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tony Thomas &#187; security</title>
	<atom:link href="http://anthonygthomas.com/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://anthonygthomas.com</link>
	<description>Father to two, husband to one, web developer and musician.</description>
	<lastBuildDate>Tue, 23 Apr 2013 00:16:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Simple Security in CakePHP</title>
		<link>http://anthonygthomas.com/2009/07/22/simple-security-in-cakephp/</link>
		<comments>http://anthonygthomas.com/2009/07/22/simple-security-in-cakephp/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 01:23:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://anthonygthomas.com/?p=134</guid>
		<description><![CDATA[When I started to dig in to investigate using the Security Component of CakePHP, I was a bit daunted. It took me quite a while to get my head around ACL after all. Then I found this article. Here&#8217;s the crux: The Security component will create a hash based on the form fields produced by... <a class="view-article" href="http://anthonygthomas.com/2009/07/22/simple-security-in-cakephp/">View Article</a>]]></description>
				<content:encoded><![CDATA[<p>When I started to dig in to investigate using the <a href="http://book.cakephp.org/view/175/Security-Component">Security Component</a> of <a href="http://cakephp.org">CakePHP</a>, I was a bit daunted. It took me quite a while to get my head around <a href="http://book.cakephp.org/view/171/Access-Control-Lists">ACL</a> after all. Then I found <a href="http://teknoid.wordpress.com/2008/11/05/make-your-cakephp-forms-a-lot-more-secure/" target="_blank">this article</a>. Here&#8217;s the crux:</p>
<blockquote><p>The Security component will create a hash based on the form fields produced by our Form Helper. If someone tampers with the form fields (by adding or removing or changing any field), the hash is not going to match with the expected one and the add() action will fail.</p>
<p>Yep, itâ€™s that simple.</p></blockquote>
<p>Really? It just can&#8217;t be that easy, can it? Yes. It can. I simply added the Security Component to my controller like so:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="language" style="font-family:monospace;">var $components = array('Security');</pre></td></tr></table></div>

<p>Sure enough, when I reloaded a page with a form in my browser, this hidden field was there:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="language" style="font-family:monospace;">&lt;input id=&quot;TokenFields1483167134&quot; name=&quot;data[_Token][fields]&quot; type=&quot;hidden&quot; value=&quot;f513aebc448fabe42c7feedf31d43fa5bd71ec79%3An%3A0%3A%7B%7D&quot; /&gt;</pre></td></tr></table></div>

<p>I installed a Firefox Add-on that allowed me to tamper with the POST data, and when I submitted the form, it failed, or in CakePHP terms, it was &#8220;<a href="http://book.cakephp.org/view/267/blackHole-object-controller-string-error">Blackholed</a>.&#8221; Awesome.</p>
<p>This isn&#8217;t going to protect me from all attacks, but it certainly is a good, easy start to implementing security in my application.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://anthonygthomas.com/2009/07/22/simple-security-in-cakephp/" rel="bookmark" title="July 22, 2009">Simple Security in CakePHP</a></li>
<li><a href="http://anthonygthomas.com/2009/05/22/roll-your-own-cakephp-components/" rel="bookmark" title="May 22, 2009">Roll Your Own CakePHP Components</a></li>
<li><a href="http://anthonygthomas.com/2010/03/14/display-form-fields-based-on-selection-using-jquery/" rel="bookmark" title="March 14, 2010">Display Form Fields Based on Selection Using JQuery</a></li>
<li><a href="http://anthonygthomas.com/2008/09/22/and-were-back/" rel="bookmark" title="September 22, 2008">And We&#8217;re Back!</a></li>
<li><a href="http://anthonygthomas.com/2010/02/18/cakephp-containable-behavior-is-your-friend/" rel="bookmark" title="February 18, 2010">CakePHP: Containable Behavior is Your Friend</a></li>
</ul>
<p><!-- Similar Posts took 5.095 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://anthonygthomas.com/2009/07/22/simple-security-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
