Amir Shevat's blog

Security issue in CakePHP code documentation

Submitted by Amir Shevat on Thu, 03/04/2010 - 19:37

I have been using CakePHP for a long time now and enjoy every second. It provides a productive, easy to use and well document platform for PHP application. The key advantages for me are – transparent OR mapping, a strong Model View Controller framework, and tons of extra utilities that make your life better.

I have came across a possible security issue in one of cakePHP code examples. This section of code is responsible to authorize or un-authorize clients access to a certain action (MVC flow)

<?php
    function isAuthorized() {
        if ($this->action == 'delete') {
            if ($this->Auth->user('role') == 'admin') {
                return true;
            } else {
                return false;
            }
        }

        return true;
    }
?>

The major security rule this code is breaking is – never ever have 'return true' as a default for an authorization method.

Forget About Software Configuration, Settings and Options – Choose the Right Defaults

Submitted by Amir Shevat on Tue, 02/16/2010 - 20:37

Common pitfall – “I am not sure what to do.... let’s make it configurable”

You hear this all the time in software companies - Some business analysts, developer or product manager trying to solve a dilemma in software development by pushing the decision to the end user side. “Let’s make it configurable” seems like a get-out-of-jail free card if you can’t make you mind about colors, screen layout and many other hard choices we have to make many time when designing our software.

CakeOTP 1.0 - Secure, Expirable, Table-less One Time Password for CakePHP Released

Submitted by Amir Shevat on Thu, 02/11/2010 - 03:34

CakeOTP is a secure, table-less and expirable implementation of One Time Password for the popular CakePHP development framework.

A one-time password (OTP) is a password that is only valid for a single login session or transaction. It is commonly used in the internet for registration and password reminder process in which OTPs are provides to the user in a form of a link that the user uses to access in order to create/reset his password.

The problem is that most one-time password implementation involve maintaining additional database tables and batch process that handle the persistence and expire date of the one time password. This adds complexity and reduces performance.

CakeOTP is a simple and clean implementation of one time password. It reduces complexity by removing the redundant SQL calls and DB batch maintenance while still keeping the one time password secure and expirable.

Download this release here.

Checkout the Online Demo, project page and getting started page.

Google to present at the Wellington Architect forum

Submitted by Amir Shevat on Fri, 01/29/2010 - 02:58


Our speaker will be James Tarquin, Enterprise Architect with Google.
He'll be speaking about the "Key challenges with cloud services", specifically security, change management and reliability.

Get copies of the flyer here both a thumbnail and a high-res copy are available here.

When: 2nd-Feb-2010 (Networking from 12 noon, formal session from 12:30 till 1:30pm)
Venue: Optimation Boardroom, 1 Grey Street, Wellington (New Zealand)

Automatic online advertisement finally developed a twisted sense of humor.

Submitted by Amir Shevat on Mon, 01/25/2010 - 21:22

In an interesting blog post about New Zealand education system moving from Microsoft to open source. I have noticed that the advertisement picked for the blog post, indicates that automatic-advertisement finally developed a sense of humor:

I hope I get the same kind of advertisement and then we can have a recursive blog post.

CakeOTP 0.1 beta release - One Time Password Reference Implementation for CakePHP

Submitted by Amir Shevat on Fri, 01/22/2010 - 04:05


I have started to implement the algorithm for tableless, secure One time password.

Here is a link to the Demo, and here is a link to the beta release.

The only thing you need to do other then the regular cakePHP setup is to create a user table (used by the CakePHP Auth component):

Morphfolia - A New Open Source CMS is Born.

Submitted by Amir Shevat on Sun, 01/17/2010 - 20:44

My friends, Adrian Kearns, finally released his excellent CMS, Morphfolia, as an open source project.

Morphfolia is two things:

  • A Content Management System (CMS)
  • A web application framework (for the typical Microsoft ASP.NET stack)

Morphfolia provides a suite of tools and capabilities that make website development and management flexible and easy.

This is achieved by a mature architecture and good design principles; the pages, content, page-layout and look & feel are all separated.

Content is served by HTTP Handlers, and APIs exist to support "standard" ASP.NET WebForm development so that your custom forms are consistent with the other content.

It provides (amongst other things) a built-in search engine, auto-generating site map, content indexes, web traffic monitoring, centralized system and audit logging.

Tableless and Secure One-Time Password (OTP)

Submitted by Amir Shevat on Fri, 01/15/2010 - 00:31

A one-time password (OTP) is a password that is only valid for a single login session or transaction. It is commonly used in the internet for registration and password reminder process in which OTPs are provides to the user in a form of a link that the user uses to access in order to create/reset his password.

Common requirements of One Time passwords are:

  1. Statistically unique – using the same password for all requests is probably not the right security choice.
  2. Hard to ‘guess’ – using sequential number is again, probably not the right security choice.
  3. Can be authenticated by the server – the server needs to distinguish between real OTP and bogus OTP.
  4. Good for one time – after the process is done the OTP should no longer be valid.
  5. Time limited – the OTP usually expires after a configurable amount of time.
  6. Secure – hackers should have a hard time changing the expiry date, username context and so forth.

Most OTP implementations use a Database table to persist the OTP and to manage their expiry date, a DB table might look like this:

id User Id OTP Expire date
1 Amir Asfsd3434bgddh 1/1/2010
2 Someone Ddfsd3345ssfsss 7/1/2010


While this is a valid solution, it is not the most efficient and elegant one, the truth is that you do not need an additional table enable and manage OTPs.

The answer is simple - the seed for this OTP is already persisted in the Database in the form of the old password (or more exactly the old password hash)

Here is how it is done:

How I Save Time Filtering Spam Comments with Mollom

Submitted by Amir Shevat on Thu, 11/26/2009 - 01:30


I get spam comments all the time, it drives me crazy and make me wish I didn't have a web site at all. Spam really bring the evil side of most site owners.

Yesterday, I finally had enough, I got 300 spam comments and only 4 real ones - I had to go over 3 pages and read bogus comments like:

"I have a question [link to gambling site]"

or "nice post [link to viagra]"

and the ho-so-known "dgsdgsdghsdfhdf [link to a SEO company]".

I went to drupal and looked for the most popular anti-spam module they listed and found Mollom.

Mollom is a web service that helps you identify content quality and, more importantly, helps you stop spam on your blog, social network or community website. When site moderation becomes easier, you have more time and energy to interact with your community.

Open source presentation at the Wellington Architect forum

Submitted by Amir Shevat on Thu, 11/05/2009 - 02:09

Just finished my presentation on Open source and Architecture in the Wellington Software Architect Forum.

We have covered these topics:
1) Definition, Licensing  & players
2) Open source based architecture examples
3) Best practices
4) ROI, TCO and other TLA
5) Open source tools for architecture
6) Want to be an open source developer?
7) Future FOSS trends

You can download the presentation here.

Powered by Drupal, an open source content management system
Syndicate content