Play Framework Security Advisory
playframework.com
playframework.com
Its between hard and impossible to build to systems perfectly that do this, whereas a server based lookup has a limited number of attacks that do not involve owning my boxes.
I have even written my own session handling wsgi middleware just because I don't understand encryption and cannot find a framework that doesn't try that.
Also, the more complex an app becomes, it's generally desirable to have less state, not more(as in sticky sessions).
Not at all sure what you mean by your second point. Sure generally simplifying things is desirable, but by complex app, I mean an app that has requirements that are complex, and many of those apps require additional session state. For instance keeping track of all categories and products browsed to target recommended products. Keep track of users' site browsing preference, search results, multi-tab interaction, etc...
When you are load balancing, request 1 goes to web/app server 1, the app server reads the session id from the cookie and read the session from the db..the next request goes to web server 2, web server 2 reads the session id from the cookie, loads the session from the db...
Each request being load balanced to a different web/app server doesn't affect the session. You are going to read the session id from the signed cookie, and then load the session from the db which is being shared between all of your web/app servers.
Having 2 or more web/app servers sharing a db is a very common setup. Db sharding is more of an exception than a norm.
Even then, db sharding doesn't affect sessions unless your sharding parameter is if the request is on web server 1, then load from shard 1(which doesn't make any sense). The code which decides which shard to query is common on all web servers and it will hit the required shard regardless.
This implementation appears to have a bug in the signing mechanism, which is pretty bad. That's why we use existing crypto libraries.
That's how we implement flaws in the process, around crypto libraries. The price of session-cache lookups is the price paid not to worry there is a serious undiscovered security flaw waiting for you around the corner.
Its a price you have to decide if its worth paying.
There is no price to pay in apps, since there are such crypto libraries for most languages.
Here are some challenges that occurred to me in a signed-cookie approach:
1) How is the signing key generated? If it's the output of a weak PRNG, maybe it can be bruteforced?
2) Where is it stored? Hard-coded in source? Data file? Command line param?
3) Same signing key on multiple servers?
4) Do you regenerate the keys periodically?
5) What if a team member leaves. Do signing keys get regenerated?
With a DB-based approach, your session data just piggybacks on the server security infrasturcture that you would have built anyway.
And the whole argument about having magically independant servers that do not need to do any secure callbacks is totally blown away by the standard approach to CSRF protection - you send a nonce to the client. If it comes back to an "independant" server, the nonce still has to be looked up and confirmed. maybe you can use cycled hashes but at some point, we need to get a server make a security callback. It just has to happen to keep things simple.
Isn't this what they invented things like Memcached and Redis for, though?
> I have even written my own session handling wsgi middleware just because I don't understand encryption and cannot find a framework that doesn't try that.
You wrote your own library that stores in plaintext because you weren't sure that pre-existing libraries were doing crypto correctly?
Why couldn't you treat those other libs' ciphertext as plaintext and apply your custom security engineering to it.
No crypto, just a lookup. Yes it introduces latency. But it is as secure as my servers are.
You can argue about solutions to each of these. My point is that each solution has their own problems. IMO, play's solution has worked well so far, making it easy to scale horizontally. I've been using play for 3 years. One security issue in 3 years, with a quick patch applied, is acceptable. Before that we used PHP, and we had many problems dealing with the huge volume of sessions to be handled.
.formatCurrency('GBP')
no longer works
Needless to say, if you think 1.2.5 to 1.2.6 is bad, don't ever upgrade to 2.x!
https://docs.google.com/document/d/1OEt6gZ3a-daSkNXqXGAM4jBs...
http://www.playframework.com/documentation/1.2.5/templates#s...
Seems the Android guys are facing the same problems with Groovy in their Gradle based build system, and the Gradle team are considering switching to Scala for Gradle 2 to keep Android on board.
(crawling back under my rock now...)