-
Notifications
You must be signed in to change notification settings - Fork 62
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
DecodeJSON accepts "{}\n some garbage data" incorrectly #42
Comments
For reference: @atticus-sullivan atticus-sullivan 4 hours ago Doesn't it help explicitly discarding everything which comes after the parsed JSON object? |
Ok, just to give some context. I'm not completely sure what exactly the problem is @carlmjohnson addressed.
So I'd like to change my overall statement that this is no problem into I think it's not that severe for now, but we should do something about it (especially as we're working on it right now anyhow). I see two possibilities:
And in the end when Do you see any other issues regarding the current state? (I learned a bit about security, but I'm not a security expert so I might have missed something or put something wrong) Maybe @carlmjohnson can add more details to the initial thought. What do you think we should do now? |
Yes, per se this isn’t so bad. It mostly just hides bugs when you accidentally send two objects. But it makes it easier to do a confused deputy attack, so it’s not great in that regard, because it leaves out a layer of depth in defense. I think the easiest solution is just reading a second object after the end of the first decoder return and ensuring that it’s an EOF error. |
Since we're discarding anything after the first JSON object, I think it's safe to close this issue. Line 42 in 14f1cb3
|
Because json.NewDecoder expects to decode a stream of objects, it lets malicious clients add garbage data to the end of a request, which may lead to a "confused deputy" security bug.
See golang/go#36225.
The text was updated successfully, but these errors were encountered: