-
Notifications
You must be signed in to change notification settings - Fork 59
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
deserialize_str with escaped strings is broken #74
Comments
@ryan-summers This is resolved by the merging of #83 |
Is it fixed?
fails with
while this one is ok:
|
You can't deserialize into a let mut escape_buf = [0; 8];
assert_eq!(from_slice_escaped::<heapless::String<8>>(br#""a\nb""#, &mut escape_buf), Ok(("a\nb".into(), 6))); |
Ah yes. Thank you! |
It's definitely not fixed. |
Right now I would classify it as more of an intentional design choice. The |
That's not the point. It doesn't need to do de-escaping. |
If the user is explicitly opting in to an API that does not claim to do string escaping, I would expect a deserialization of r#""\n""# to result in a deserialized "\n", or am I misunderstanding something? Are you referring to the removal of the inner quotes? I'm just a bit confused here |
I think a good default for I understand that you dont want to change the behavior |
The only correct deserialization is one that understands escaping. It's part of Json. If it can't, it must error. Not doing so is a bug, likely even a severe security issue. |
Could someone please reopen this and mark this as a security vulnerability? |
I don't have permissions for any security-related issues on this repository. CC @eldruin can you help us out here? |
Sorry for the delay.
Plus the CVSS scoring. |
serde_json_core
needs to refuse deserializing a borrowed string with escape sequences.serde_json_core::from_slice::<&str>(br#""\n""#)
incorrectly givesOk(("\\n", 4))
.serde_json::from_slice::<&str>(br#""\n""#)
correctly saysError("invalid type: string \"\\n\", expected a borrowed string", line: 1, column: 4)
.The text was updated successfully, but these errors were encountered: