Skip to content

Validation of a foreign token makes the lib get stuck on a never resolved promise #35

@Xalag

Description

@Xalag

Describe the Issue

When I try to validate a token which is not signed with any of the key-id's which are available in the jwksUri, then the library gets completly stuck, because the cached promise will never resolve nor reject.

In my case we have support for multiple IDPs and the token to validate was from another IDP as the jwksUri points to.

To solve this, the logic for fetching from the jwksUri and caching public keys by key-id need to be changed.

Expected behavior

The library should return that the token is invalid or should return that for the key-id of the token, there was no PublicKey found.
The library should not return an ever-pending promise.

Steps to Reproduce

Try to validate a token which is from another IDP than the jwksUri.

Other Information

In theory, the current implementation of verify.ts should also have the issue, that, if there is a network problem and fetching the jwksUri fails, there will be an ever-pending promise in the cache which then leads to a similar issue that the lib gets completly stuck. But this case I have not explicitly tested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions