Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling JOSE.JWK.block_encrypt with an invalid JWK never resolve #120

Open
arnaudmorisset opened this issue Jul 26, 2021 · 2 comments
Open
Labels
Milestone

Comments

@arnaudmorisset
Copy link

Expected Behavior

Either:

  • Calling JOSE.JWK.block_encrypt/3 with an invalid value for the third argument (jwk) should send back a relevant error.
  • Calling JOSE.JWK.from_pem/1 with an invalid key as an argument should send back an error instead of [].

Current Behavior

Calling JOSE.JWK.block_encrypt/3 with an invalid value for the third argument (jwk) hangs and never resolve.

Steps to Reproduce

  1. Open an interactive shell in a Mix project using erlang-jose
  2. Parse an invalid Public Key using JOSE.JWK.from_pem/1; you should get []
  3. Use [] as the third argument when calling JOSE.JWK.block_encrypt/3
  4. The process will hang, and you will be forced to interrupt it

Context (Environment)

After a configuration error, we got an invalid Public Key in our database, and we tried to use it to generate a JWK, then we try to use this invalid result to encrypt a token. As the function call was never resolved, our HTTP endpoint produced a timeout error.

@1st8
Copy link

1st8 commented Dec 13, 2021

Did you find a workaround?

@arnaudmorisset
Copy link
Author

@1st8 Adding defensive code around the function call to be sure that we never call it with an invalid value. 🤷‍♂️

@potatosalad potatosalad added this to the jose 1.12.0 milestone Sep 1, 2022
@potatosalad potatosalad added the bug label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: To do
Development

No branches or pull requests

3 participants