Auth and everything wrong

I attempt to describe what little I know about authN/authZ and what the future should probably look like.

Perspective and disclaimer

I know less about these specs than I should, but I have seen the fires created from people (myself included) attempting to implement them.

OAuth2

OAuth2 is a disaster of a specification, and not only because it’s actually a collection of specifications. Here’s how I’ve seen it go wrong.

Security is mostly omitted

OAuth2 often (not always) relies on TLS to protect tokens.

By delegating security to the wire instead of the data, OAuth2 relies on the ancient concept of hardened outside and soft center. OAuth2 access tokens are, by design, supposed to allow for one app acting on behalf of another. It’s up to application developers to secure these tokens from any other things that may have shared access to other parts of their application.

OAuth2 says “here’s how to get a token and where you should send it,” but neglects to adequately define how to protect this token.

No token format definitions

On the token consumer side, there’s a general list of stuff you should probably look at (token expiry, signatures, etc.), but how are these tokens stored? Very luckily we have RFC6750 which tells us how bearer tokens are used.

It says nothing about their actual format, though the one example it gives returns data as JSON. It takes RFC7519 (accepted years later) to define a JSON web token (JWT).

EIGHT YEARS after RFC6750 was written, we have a DRAFT of how to use JWTs in OAuth2.

Excuse me? Doesn’t any worthwhile OAuth2 implementation use JWTs? What have we been doing this whole time?

Turns out: whatever the heck we wanted!

But RFC7519 defines what should be in a JWT!

RFC7519 defines the JWT format and a minimum set of claims that should be in each token. It also stops short of differentiating between an access token and an ID token. Implementers can add any claims want, which is how we ended up with these proprietary, incompatible, customizeable JWT implementations.

What practices are best anyway?

Given all of the above, OAuth2 has taken years to figure out best practices, and in general is tricky for developers to get right.

What if I told you OAuth2 is so large in scope it doesn’t just have a section on security threats, it has RFC6819, which is four pages long?

I’m kidding, of course. Four pages only covers the table of contents.

What probably doesn’t work?

To patch OAuth2 (or at least OAuth2-like token exchange) into something more secure or useable I have seen the following attempts:

So much whine

In the next part, I’ll summarize what patterns I’ve seen from next-gen auth attempts.

In the next next (last?) part, I’ll summarize what I think should come next for authorization.