kenichi/angelo

Invalid JSON data makes the server crash

mighe opened this issue · 2 comments

When an invalid JSON string is sent to the server, the function parse_post_body raises a ParseError and it crashes.

I think the best approach would be sending back to the client an halt 400 (BadRequest).
To do so we have a couple of ways:

  • make the params evaluation eager and catch the exception
  • every request handler is executed in a safer way and it sends the error code when an error is raised

Probably the latter is a bit better because it will make more reliable every Angelo instance without overhead.

What do you think?

@mighe can you help me out with some repro steps? so far, i've been seeing it handle malformed JSON correctly when it hits this line.

Sorry @kenichi , my fault, I made a nasty mistake: I was actually calling params method inside another thread!
We can close 👍