Open source CFML

Written on 21 September 2014, 10:42pm

Tagged with: , , ,

Over the weekend I played for a while with the open source alternatives to Adobe’s ColdFusion: Railo and Open Blue Dragon (I know, strange name).
[Usability break] This is how is how their presentation website looks like:

OpenBD
getRailo.org
OpenBD scores more usability points for clearly explaining itself in a sentence, the clear navigation and good use of colors. Oh, and it’s responsive! 😎
Railo on the other hand offers a search box, but it’s confusing with its 2 levels navigation system and small carousel. The choice of colors is a bit odd, the logo looks childish and the overall experience is reminding of the websites from a decade ago.
[/End Usability break]

Coming back to the open source CFML engines, I think that Open CFML Foundation provides a very good starting point in understanding the basics and the main actors (BTW – did you know that jpl.nasa.gov is powered by Railo?)
Here are some additional resources comparing Railo, Open BD and Adobe’s ColdFusion:
– ColdFusion or Railo ?
– Some differences between the 3 alternatives
– cfml.io – a common languange reference for the ColdFusion Markup Language.
– Comparing installations: CF10, Railo and OpenBD

Readig the first article in the list above, I saw this CON for Adobe ColdFusion:
CON: Bugs are not fixed quickly, if at all, some have been around for years.
It instantly reminded me about the 29 February bug present in ColdFusion 8. I detailed it here, and in short, it’s about the cfftp tag being unable to list files modified on the 29th of February.

So I wanted to check if this problem is also present in Railo and OpenBD. I installed the Jetty-powered zip archives, unzipped and ready to test (versions Railo 4.2 and Open BD 3.1).

First I had to touch -d some files on my server, then to fire up the FTP connection using the cfftp in the 2 cases.


me@hostname [/home/me/tmp/29feb]# ls -lh
total 8.0K
drwxr-xr-x 2 me me 4.0K Sep 21 22:35 ./
drwxr-xr-x 9 me me 4.0K Sep 21 18:59 ../
-rw-r--r-- 1 me me    0 Jan 31  2007 file1.txt
-rw-r--r-- 1 me me    0 Feb 29  2012 file2.txt
-rw-r--r-- 1 me me    0 Sep 21 18:59 file3.txt

As it turns out, both engines are correctly showing the file modified on 29 February 2012:
railo vs openbd

So here is one of the big advantages of the open source alternatives: bugs fixes and patches are released more quickly. Moreover, you can be the one implementing them 🙂

Don’t hash secrets

Written on 21 September 2014, 04:10pm

Tagged with: , , ,

Don’t hash secrets, HMAC them!
This is an old but incredibly useful article written by Ben Adida, currently director of engineering at Square, previously working at Mozilla.
The idea is that simply hashing + salting the secrets is not enough. You need to HMAC them (Hash-function Message Authentication Code). HMAC always uses a hashing function (like MD5, SHA1, etc), but this hashing function is not used to hash the secret alone.

If you know SHA1(secret || message), then you can compute SHA1(secret || message || ANYTHING)
You don’t need to know exactly how HMAC works, just like you don’t need to know exactly how SHA1 works. Under the hood, what’s approximately going on is two hashes, one after the other, with the secret combined after the first hash.
– Don’t hash secrets, HMAC them!

PHP has the hash_hmac function starting with the version 5.1.2. Interesting enough, CakePHP’s default authentication mechanism only uses hashing+salt, not HMAC. And MediaWiki uses something closer to HMAC.

But there’s a catch. If the secret is longer than the block size of the hash function, then HMAC will use the hash of the secret. See here and here (screenshots below)

custom_hmac
hmac2

And this leads to the following problem:

Mathias Bynens elaborates this:

SHA-1 has a block size of 512 bits, which equals 64 bytes.

So in this case, if the supplied key takes up more than 64 bytes, then SHA1(key) is used as the key. More generally, for any chosen_password larger than 64 bytes, the following holds true (pseudo-code):

PBKDF2_HMAC_SHA1(chosen_password) == PBKDF2_HMAC_SHA1(HEX_TO_STRING(SHA1(chosen_password))

PBKDF2+HMAC hash collisions explained

Takeaway? Don’t hash secrets, HMAC them. But make sure that the length of the secret is not larger than the block size of the hashing algorithm.
On the same line, maybe using passwords longer than 64 bytes is not such a good idea… 🙂

iStock_000020861023Small
Photo: istockphoto

I am not buying the new iPhone 6

Written on 18 September 2014, 09:41pm

Tagged with: ,

For some reason I will have to get another smartphone pretty soon. Since switching the platform is not an option, I was expecting that the new iPhone 6 would be just the right thing.
Turns out, it isn’t.

Here’s why:

1. The battery: On iPhone 6 it’s more or less the same as on the 5s (on 6 Plus is marginally better, but 5.5′ size does not appeal to me at all). We are in 2014, we get excited about the new shiny iPhones, but at the end of the day their battery is dead. Can we please put less effort into drawing hearts and emoji on a watch and more into a technology to replace the decades-old Li-Ion one? Pretty pretty please?

design_details_right_large

2. The pill-shaped design with protruding camera: I love the iPhone 4/5 flat-sided form. I got used to it, it’s much more useful when taking pictures and it just feels right. The pill-shaped form reminding of the original iPhones and the current iPads seems less appealing to me. And the protruding camera… it’s simply not understandable from a design-centric company like Apple. I personally would have preferred the extra millimeter and a few more grams to have the camera inside the phone plus a bigger battery. Apple does its best to make it less visible in their presentation photos:

With clever lighting and placement Apple hides that bump in profile view where it clearly would ruin the clean line and sleek looks. That doesn’t make the iPhone 6 bad, but it leaves a bad taste in my mouth. If you are embarassed about the bump then don’t have it, but if you have a bump I think you need to own the bump.
Ben Brooks via cultofmac.com

iphone 6

3. The price: Until now I was pretty comfortable with the 16GB version. However, sometimes I feel the need of extra storage, but 64Gb would be too much. 32Gb would have been just right. But wait, there is no iPhone 6 with 32Gb…
I feel the same as John Gruber:

I don’t understand why the entry level storage tier remained at a meager 16 GB. That seems downright punitive given how big panoramic photos and slo-mo HD videos are, and it sticks out like a sore thumb when you look at the three storage tiers together: 32/64/128 looks natural; 16/64/128 looks like a mistake. The original iPhone, seven years and eight product generations ago, had an 8 GB storage tier. The entry-level iPhones 6 are 85 times faster than that original iPhone, but have only twice the storage capacity. That’s just wrong. This is the single-most disappointing aspect of the new phones.
–One more thing

Adding up to the list above:
– for the moment I don’t feel the need for a bigger screen
– the Apple Pay would have been a selling point for me, but it will take another year or so until it will land to Belgium.

So iPhone 5 it’ll be. 32Gb gold if possible 🙂

PS – here is how Steve would have introduced the iPhones 6 and the Apple watches: http://jiggity.com/steve.html