Skip to content

RelyingParty.verify_registration does not validate response shape #497

@sfnelson

Description

@sfnelson

Following the examples, our app uses verify_registration(response, challenge) with untrusted inputs for response.

In production, we've seen users submit data such as this:

{"id":"...","rawId":"...","response":{"clientDataJSON":{},"attestationObject":{}},"authenticatorAttachment":"platform","clientExtensionsResults":{},"type":"public-key"}

While this is obviously invalid, the library attempted to decrypt {} as an attestationObject, failing with undefined method 'end_with?' for an instance of Hash. This caused a 500 inside critical code.

After reviewing the chain that leads to the Base64UrlEncoder.decrypt call I'm not clear on where the responsibility for sanitising user inputs should be. Is it expected that library callers check that the response conforms to an expected shape?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions