News for hackers. Stuff that matters.
Re:HTTP cookies, or how not to design protocols by tptacek on Friday October 29, 2010 @01:24PM (#1848062)
HTTP Authentication is dead and is never coming back. Leave aside all protocol design elegance arguments and think about the situation for app developers; form auth is simply better:

* It has a simple reliable log-out button.

* It gives app developers more reliable fine-grained control over the login process because it in no way relies on browser chrome.

* It better supports advanced security and UX idioms, like signup-or-register or SMS-me-a-one-time-login.

* Virtually every web app in the world needs a session-keyed store anyways, and authentication is the easiest of the AAA problems anyhow, so building that one tiny piece into the protocol doesn't solve any problems.

* [ps]

Doubtless there are a myriad of nitpicky arguments about how HTTP Auth can be massaged to mitigate these problems, but who cares? Cookie auth works for everyone. Basic auth manifestly does not. Why would anyone want to expend major effort to take an archaic protocol and make it asymptotically as good as what every web app stack already provides?

[ps]: Cookie auth schemes can also be extended without getting Microsoft, Mozilla, Google, and Apple to agree on anything; this is the [end-to-end argument in systems design] in action.

Re:HTTP cookies, or how not to design protocols by mjw on Friday October 29, 2010 @04:15PM (#1848844)
It's certainly not dead when it comes to RESTful web services APIs. It's often the best choice for authenticating these.

In a browser context, most of the UI criticisms have little to do with the protocol itself and could be easily addressed if browsers would add a little more HTML + javascript API support for doing HTTP auth logins and logouts. Admittedly that looks unlikely to happen in the near future, which is a shame IMO. IIRC they were considering it at one point for HTML5.

Re:HTTP cookies, or how not to design protocols by tptacek on Friday October 29, 2010 @04:18PM (#1848855)
I feel like I could win an argument that it's never the best choice for authenticating RESTful services, because it implies that authentication is username/password based, and there are often better idioms for app-to-app / company-to-company authentication than usernames and passwords.
Re:HTTP cookies, or how not to design protocols by mjw on Friday October 29, 2010 @05:09PM (#1849046)
Gotcha.

Is there not any scope for improvement on this front using alternative HTTP auth schemes though? (As far as I'm aware the standard has room for schemes other than Basic and Digest, although I suppose limited to the challenge-response format)

At any rate, it'd be nice if there was an effort to work with the HTTP standard (or if not possible, propose extensions to it) and aim for clean protocol design where at all possible when driving to improve API security.

SSL + HTTP Auth has been pretty good for us, and it's a good fit for the RESTful design goals of the protocol, so I'd be sad to see it thrown out, rather than improved where necessary.

Re:HTTP cookies, or how not to design protocols by tptacek on Friday October 29, 2010 @05:25PM (#1849106)
Seriously: the opposite of this sentiment is true. We should be working to hoist stuff out of HTTP. Authentication is a perfect example of something that endpoints should be able to decide without having their options influenced by the protocol.

If there's a single advantage to conveying a username/password in a dedicated HTTP header as opposed to any other way of using HTTP to convey the same information, it hasn't been well articulated to me. Down with HTTP Authentication!

Re:HTTP cookies, or how not to design protocols by defen on Friday October 29, 2010 @09:24PM (#1849758)
I think you're right. If you look at the standard HTTP header fields, almost all of them demand/specify information about the resource itself, its representation, or the mechanics of the transfer thereof.

The others: Host - necessary for multiplexing over the predominant transport protocol Date - necessary for caching Referer - mostly useless and optional anyway User-Agent - information about the client and essentially useless Server - useless

And then there are the bastard children: Cookie/Set-Cookie - used to turn HTTP into a stateful protocol Authorization/WWW-Authenticate - used to transmit information about the relationship between the client and server.

Re:HTTP cookies, or how not to design protocols by mjw on Sunday October 31, 2010 @03:23PM (#1854057)
Well, I think you'd want to think carefully before pulling things out of HTTP and forcing HTTP to sit on top of a stateful, session-based protocol in order to achieve them.

The statelessness of HTTP is one of its major strong points, making it easy to load-balance and scale, more easily compatible with a wide range of middleware, etc. The redundancy involved in repeating certain headers is a design trade-off made for a reason.

There's a bunch of trade-offs here in the protocol design though, evidently. Coming at it from a security perspective seemingly leads to a different view of those tradeoffs than (say) Fielding has.

If you have an application with a really pressing need for stateful session-level protocol features though -- perhaps HTTP isn't the best choice anyway?

Re:HTTP cookies, or how not to design protocols by IgorPartola on Friday October 29, 2010 @10:05PM (#1849848)
User-Agent is far from useless. When filling out support forms wouldn't you rather skip all the annoying questions about your OS and browser?
Re:HTTP cookies, or how not to design protocols by defen on Saturday October 30, 2010 @01:12AM (#1850161)
Good point - it's become the de-facto way of communicating client capabilities to the server.
Re:HTTP cookies, or how not to design protocols by kls on Friday October 29, 2010 @05:49PM (#1849171)
It's often the best choice for authenticating these

SAML is a better auth mechanism for REST services.

Re:HTTP cookies, or how not to design protocols by tbrownaw on Friday October 29, 2010 @04:07PM (#1848805)
HTTP Authentication is dead and is never coming back.

What should WebDAV shares use instead? I don't think form auth really works for that.

Re:HTTP cookies, or how not to design protocols by tptacek on Friday October 29, 2010 @04:21PM (#1848863)
WebDAV is a good point but may be the exception that proves the rule, since it is itself such a misfeature. Meanwhile, mentally amend my assertion to "HTTP authentication for browser-based web applications is dead and is never coming back".