-
Notifications
You must be signed in to change notification settings - Fork 28
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
Make Challenge generation more customisable #90
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m still not convinced we need to mess with the generator here — you really shouldn’t be picking anything other than a random number for the challenge on anything other than tests, and if you are concerned about fulfilling responses across multiple systems, you should use redis or a database to keep all of them informed of which challenges were used for whom after the response is generated, but before it is delivered to the user.
If you have a use case you think is valid, please elaborate on why you think this is a solution to that so we can see if any alternatives exist first.
This pull request reponds to a need we have here while keeping the current behavior still working. I’m just adding some behavior for a given context where server has no access to the user database and work in a load balanced environment. |
I want to clarify that I’m not pushing back because I think it’s bad for the project, but because you are likely opening your system to being vulnerable if you aren’t using a random challenge as is provided. The manager is not stateful, and nothing is preventing you from signing your challenge with a private key and delivering it to the client along with the response, and you sending it back when the client delivers/signs with their key. However, you still need to make sure the challenge is not re-used or a replay attack can open you up to abuse, which brings you back to needing to design a way to store them even temporarily (see https://www.w3.org/TR/webauthn-2/#sctn-cryptographic-challenges for more here) Controlling how these challenges are generated without being very careful will likely make it easier for others to make similar mistakes, which is my primary worry, but if you have a scheme in mind that doesn’t have any major flaws, then I’d prefer we support that directly rather than poking a hole anyone can unintentionally misuse. |
Here is my proposal : we keep the challenge management as it is, but we just add the ability to append custom data at the end of random array. Then, we keep the randomness of the challenge, and add the ability to add custom data. what do you think about that ? |
I've put some changes that keep challenge generation internal and allow adding custom data on challenge. |
Make Challenge generation more customisable