-
Notifications
You must be signed in to change notification settings - Fork 10
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
Validate PWS and OTP string length #161
Comments
I am not super opposed to it. Are there any guarantees that these lengths stay the same between releases, though? Are they different between different models? I think these were my main worries in the past. From my perspective there is a trade off between implementation complexity/ease of maintainability and user-experience and the gain in UX seems pretty low here (especially in the face of other gaping unaddressed issues such as this one Nitrokey/nitrokey-storage-firmware#77). |
No, there are no guarantees. As far as I know, the limits are currently the same over all devices. I do expect the limits to change for the next Nitrokey generation, but that will require some modifications anyway. Nevertheless, I intend to add getters for these limits to
I think it’s hard to compare these two issues. You mention a firmware bug that we can’t address in
That’s really annoying! All three strings seem pretty short, so I have to start guessing how much characters I have to remove from which string. |
Thanks! Sounds good. Yeah, I think with proper exposure from |
I suppose there is also an implementation variation in which we just "update" one field after the other, amounting to three |
I’d rather validate the input. Even if we use a raw hidapi backend, it
would be nitrokey-rs’s job to keep track of the limits. (And if there
are major firmware updates that change the limits, nitrokey-rs would
probably need an update anyway.)
|
Previously, we didn’t check the length of the input data in the otp set, pws add and pws update commands. While libnitrokey does check the input and return an error if a string is too long, it cannot inform us which of the input strings is the problematic one. With this patch, we manually validate the input string lengths for these commands to improve the error messages, clearly stating which strings are problematic, how long they are and how long they can be. Fixes d-e-s-o#161.
Previously, we didn't check the length of the input data in the otp set, pws add and pws update commands. While libnitrokey does check the input and return an error if a string is too long, it cannot inform us which of the input strings is the problematic one. With this patch, we manually validate the input string lengths for these commands to improve the error messages, clearly stating which strings are problematic, how long they are and how long they can be. Fixes #161
Currently, we leave the validation of PWS slot names, logins and passwords as well as OTP slot names and secrets to
libnitrokey
which returns an error if a string is too long. There are two problems with this:While I consider 1. to be a bug in
libnitrokey
and/or the firmware, 2. is a legitimate issue. I suggest to store the maximum lengths as constants innitrocli
and to validate the user input, providing helpful error messages like:@d-e-s-o What do you think?
The text was updated successfully, but these errors were encountered: