Skip to content

Invalid JSON messages triggers an unhandled exception in JsonWebsocketConsumer and AsyncJsonWebsocketConsumer #2219

@JulienPalard

Description

@JulienPalard

Hi!

On malformed json sent by clients to JsonWebsocketConsumer or AsyncJsonWebsocketConsumer, a JSONDecodeError is raised and left unhandled.

The unhandled exception stops the django process (which will be restarted by Daphne so that's OKish).

But this looks fragile to me: a malicious user could spam malformed messages, with various effects like having the admin inbox to quickly fill if AdminEmailHandler is used.

I think malformed messages should be logged and ignored, but not raise an unhandled exception, what do you think?

Related to #1339

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions