Subject: [jose] "crit" (Critical) header parameter: unnecessary constraints

From: "Manger, James H" <[email-masked]>
Date: Mon, 29 Apr 2013 00:30:34 +1000

The "crit" header parameter has been made unnecessarily complicated. It should say the "crit" parameter is an array of strings; a JOSE message MUST be rejected if any of the strings in the array is not understood.

The current definition includes additional constraints: the array "MUST NOT include header parameters defined by this specification, duplicate names, or names that do not occur as header parameters within the {JWE|JWS}".

This extra "MUST NOT" just adds extra work for implementations. Instead of simply checking that each "crit" string is in an implementation’s hardwired list of understood strings (probably 1 line of code in many languages), an implementation additionally has to check each "crit" string against headers defined in JWE/JWS specs (which version?), and check for duplicates, and check that each "crit" string is present in the JOSE message (at the top level?).

I cannot see any benefit from these additional checks; just an extra burden on implementers. I am also sure many implementation will not bother enforcing these additional checks, making them an interop mess.

"crit" strings need a registry. We should replace the "typ" registry with a registry of "crit" values. "typ" was ill-defined even before a recent draft muddied it further by defining different values based on the serialization being used (eg "typ":"JWE" and "typ":"JWE-JS").

P.S. We really need to stop defining so many things in duplicate or worse -- in JWS and in JWE. We really need to define a JOSE message.

--
James Manger