I’ve been in the JWT space for a while now, mostly through the ruby-jwt gem. The post about the 3.0.0 release ended with “Now just crossing fingers there is no major compatibility problems…”. That was only half a joke.

The pain

Every time ruby-jwt was about to change how it reads tokens the question was the same: what do the other libraries create and what do they accept? Answering that meant installing a bunch of languages and writing small scripts for libraries I had never used or thinking I should but never did.

AI to the rescue

Some kind of automated test suite for this has been on my mind for years. What stopped me was the boring and tedious part, 13 languages means 13 toolchains and build setups. Giving the task to an agent was easy and after a few iteration we have jwtcompat.dev. A site that collects how JWT/JOSE/JWA libs talk to each others.

Every library signs tokens with the algorithms it supports and verifies what the others signed. On top of that every library gets known attacks, tokens that bend the RFCs and the keys identity providers publish.

I take no credit of the quality of how the different libraries are used and there are probably some flaws.

What did it find?

Good news first, none of the libraries accept the known ways of forging a token, think we already knew that. Then some less clean stuff, for example:

  • 18 of 33 libraries accept a padded signature
  • 3 accept "alg":"hs256" even if algorithm names are case-sensitive, ruby-jwt is one of them (#820)
  • Yahoo and Intuit still publish 1024-bit RSA keys

Most of these are not bugs, more differences worth knowing about.

If your favourite library is missing, the repo is open for issues and pull requests. Still crossing fingers when releasing, but not as hard anymore.