Skip to content

non-ASCII/non-url safe characters characters in nonce/state/etc #95

@jogu

Description

@jogu

I feel like we should probably take a position on the use of non-ASCII, and possibly even non-URL-safe characters, in state & nonce - at a minimum recommending that only URL safe characters are used.

state is already limited to ASCII by https://www.rfc-editor.org/rfc/rfc6749#appendix-A however this is no similar limitation for nonce (OpenID Connect just defines it as a "a string".)

I think in practice most experienced OAuth2 practitioners tend to restrict state & nonce to the URL safe character set.

The guidance VP currently gives on creating nonce is:

(1) The Verifier selects a nonce value as fresh, cryptographically random number with sufficient entropy and associates it with the session.

Something like this would probably be better:

(1) The Verifier generates 16 fresh, cryptographically random bytes with sufficient entropy, associates it with the session and base64url encodes it for use in the nonce parameter.

The advantage of limiting the character set as that it makes implementations/interop easier, as common mistakes in handling character sets (e.g. using Latin1 instead of UTF-8) or incorrectly handling URL escaping/unescaping, have no practical effect.

In contrast if we didn't impose a limitation then the conformance tests probably need to test the full set of characters allowed by the specification, and this is likely to mean the tests are significantly more difficult for implementations to pass. e.g. just yesterday I saw a node.js implementation that was encoding a non-ASCII character in nonce into a JWS in something other than the required UTF-8 and it wasn't obvious why it was doing that or how to fix it, and I've seen characters like ';' or '&' cause issues when used in url queries.

(I'm not sure if there any other places - at least other than the credentials themselves - where non-URL-safe characters are likely to appear in OID4VP?)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions