photo / frontend

The official @github repository of the Trovebox frontend software. A photo sharing and photo management web interface for data stored "in the cloud" (i.e. Amazon S3, Rackspace CloudFiles, Google Storage).
https://trovebox.com
Apache License 2.0
1.38k stars 244 forks source link

Use bcrypt to encrypt secrets #759

Closed jmathai closed 10 years ago

jmathai commented 12 years ago

Given the recent hacks on LinkedIn, eHarmony and Last.fm we should properly encrypt out secrets using bcrypt.

oscherler commented 12 years ago

I’m interested in this one. Are there any secrets to bcrypt, other than the user password?

jmathai commented 12 years ago

@oscherler MySql Password, AWS, Dropbox and other user tokens. There's a handful of things to be encrypted.

oscherler commented 12 years ago

I’ll assume that you’re talking about bcrypt the cryptographic hash function, that all the “store your passwords using bcrypt” refer to, and not the unrelated bcrypt cross platform file encryption command-line utility that I wasn’t aware of until today. Also, I hope I won’t be making a fool of myself in what follows, don’t hesitate to tell me if it’s the case. :D

bcrypt is a hash function. It only works one-way, so it’s good for password verification (at login). But for MySQL, AWS and Dropbox, we need the actual secrets in order to connect to the services, so we need to be able to decrypt them. It means we need:

I suggest we make two separate issues, one for hashing the user password and one to encrypt the secrets.

oscherler commented 12 years ago

OK, I volunteer for this one. If it suits you I will do some research, think up a system, then make a proposal here for review. I think it’s more efficient than just asking question as I go.

jmathai commented 12 years ago

@oscherler Your comment is correct and this only applies to the user password. All others are two way hashes. We'll want to store row level salts as part of this fix and that's tracked in #939.

See #940 to enhance the two way symmetric encryption.

jmathai commented 12 years ago

@oscherler Were you still wanting to take this issue? It's in the 4.0.0 milestone and there's just about 5 issues remaining. Let me know and I can take it if you're short on time.

oscherler commented 12 years ago

I’ve indeed been short on time. I could spend some time on ti this weekend, but probably not enough to finish, so I think it’s better if you take it. Sorry for the delay. I’ll peek at the commits, though, because it’s an interesting topic. :)

oscherler commented 12 years ago

I’m now on holiday, so I took a shot at it (but if you already started working on it, don’t worry about me, learning more about security is never lost). You can see my commits there:

https://github.com/oscherler/openphoto-frontend/commits/user-bcrypt

There are comments inside the commits on GitHub. Some notes:

jmathai commented 12 years ago

Awesome. Thanks for that. Go ahead and send a pull request, it's easier to leave comments that way. I'm returning from being out of town for a week so I might be slightly delayed in responding for the next few days.

walkah commented 10 years ago

I'm actually going to recommend that we go with the 5.5 password* functions for a bit of future proofing (bcrypt fully supported): http://php.net/password

There's a backwards compatibility layer for 5.3+ here: https://github.com/ircmaxell/password_compat (we'll use this).

I'm gonna take this one

jmathai commented 10 years ago

@walkah can you make a note in src/libraries/compatability.php that we're providing fallbacks for password_* functions in this library?