-
-
Notifications
You must be signed in to change notification settings - Fork 8
validate digest lengths #5
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
Comments
I guess in the use cases I was using this for, there wasn't any knock-on effect of this happening. If they were longer or shorter didn't really affect the security of the result (as far as any way I could tell), but I can see how having this guarantee would bring peace of mind. Do you have a specific use case where this would cause problems for you? I guess if you're expecting general validation of these as-is... |
I guess what makes this complicated is that you probably end up having to decode the base64 string, pulling in some more crates to do this properly. I'm fine to do the base64 decoding and comparison against expected digest sizes outside, but I guess then it should be documented this crate doesn't do any further sanitization of the encoded digest. |
I opened #6 to add this remark to the docs. I also saw you already do pull in the I won't implement that though, as I ended up not being able to use this crate - the SRI hashes I needed to decode can also be |
yeah it's not a super complicated thing to roll up yourself, for the most part. :) |
BREAKING CHANGE: new type signature of Hash, digest lengths are now validated Fixes: zkat#5
Currently this crate does not validate the SSRI hashes to actually encode a digest that matches the size of the hash function used.
This means, the following SSRI succeds to parse:
… even though this only encodes 27 bytes, not 32:
I'd expect this to fail.
The text was updated successfully, but these errors were encountered: