{"id":818,"date":"2008-10-20T16:00:52","date_gmt":"2008-10-20T23:00:52","guid":{"rendered":"https:\/\/www.reenigne.org\/blog\/?p=818"},"modified":"2008-10-14T21:04:45","modified_gmt":"2008-10-15T04:04:45","slug":"php-could-be-more-secure","status":"publish","type":"post","link":"https:\/\/www.reenigne.org\/blog\/php-could-be-more-secure\/","title":{"rendered":"PHP could be more secure"},"content":{"rendered":"<p>Given that PHP is designed to be used to write applications that run on web servers, you&#8217;d think it would have been designed rather more with security in mind.<\/p>\n<p>In particular, PHP&#8217;s dynamic typing seems to be a source of security weaknesses. Dynamic typing has advantages in rapid development and code malleability but is not particularly helpful for writing secure code &#8211; security is greatly helped by being able to restrict each variable to a specific set of values and having the compiler enforce this.<\/p>\n<p>Similarly with the SQL API &#8211; because the interface is all just strings instead of strongly typed objects, SQL injection vulnerabilities becomes all to easy to write.<\/p>\n<p>Variable scope is another one &#8211; because there are no variable declarations it&#8217;s not obvious where variables are introduced, so one could be using variables declared earlier without realizing it (this is why register_globals changed from default-on, to default-off, to deprecated to removed).<\/p>\n<p>Then there are ill-concieved features like magic quotes, and missing features like cryptographically secure random number generation.<\/p>\n<p>A well-designed language for web development would be secure by default when doing the most obvious thing &#8211; one shouldn&#8217;t have to go out of one&#8217;s way to learn what all the security pitfalls are and have to write to explicitly address each of them (and update your code when the next such pitfall is discovered).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Given that PHP is designed to be used to write applications that run on web servers, you&#8217;d think it would have been designed rather more with security in mind. In particular, PHP&#8217;s dynamic typing seems to be a source of security weaknesses. Dynamic typing has advantages in rapid development and code malleability but is not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-818","post","type-post","status-publish","format-standard","hentry","category-language"],"_links":{"self":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/818","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/comments?post=818"}],"version-history":[{"count":1,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/818\/revisions"}],"predecessor-version":[{"id":819,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/818\/revisions\/819"}],"wp:attachment":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/media?parent=818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/categories?post=818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/tags?post=818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}