My first Rails complaint: What, no authentication?
Okay, it’s time for my first gripe about Ruby.
There’s no built-in authentication system.
There’s built-in everything else, but when it comes to authentication, for some reason we’re left to the mercy of generators/plugins/engines/etc., all of which are written by people with very limited experience with cryptography.
MD5? SHA-1? Seriously? Are people still writing new applications using these algorithms? Are people still writing applications based on hash algorithms without building in any algorithm agility? Sweet mother of God, why?
I’m supposed to not only take seriously but also use the product of someone who spells it “cypher?” (Quick tip, kids: Cypher is the weasely guy from the Matrix moves. Cipher is the cryptographic thingy.) Oh Lord take me now.
The best I’ve found so far is Bruce Peren’s ModelSecurity, which is really, really ugly. Butt-ugly. So ugly you’d pronounce it “yoo-gly.”
For anyone listening, here are crucial points to consider when designing an authentication system.
- Do not use MD5 or SHA-1. These are seriously flawed algorithms, so much so that it’s putting that entire family of algorithms in doubt. MD5 was considered broken last year, and SHA-1 looks just as bad. Bottom line?
Don’t make Bruce Schneier come kick your ass.
- Salts are best used on a per-entry basis. If you’re going to use a random salt to store a user’s password with (e.g.
hash(salt + password)), you might as well go the extra five minutes and do it on a per-user basis, not a per-site basis. The whole point is to increase the computational cost of a rainbow table/offline bruce force attack, not fudge the hash function it uses a little bit. - Keep it simple, jackass. Don’t make it the all-singing, all-dancing spaz-mo-tronic wonderblunderbubblebuggy. Remember why you like Rails: it provides you with meaningful defaults. It doesn’t do everything for you.
I’m going to have to implement my own, aren’t I?
6 comments »