Skip to content

janpieper/bandit-issue-173

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gangster

This application is used to demonstrate an issue discussed in bandit#173.

Setup

Get dependencies and compile the application:

mix deps.get
mix deps.compile
mix compile

Start the application:

iex -S mix

Usage

Use websocat to connect to the websocket:

websocat ws://127.0.0.1:6789/ws

Messages that can be parsed as JSON should be answered with "ok":

$ websocat ws://127.0.0.1:6789/ws
{"name":"jan"}
ok

Messages that can NOT be parsed as JSON will not be answered:

$ websocat ws://127.0.0.1:6789/ws
hello world

Problem

Open the websocket connection like described above and try sending multiple messages that cannot be parsed as JSON:

$ websocat ws://127.0.0.1:6789/ws
hello world
this is
not json

You'll see these messages in the IEx:

[info] Starting websocket
[warning] Incoming message "hello world\n" could NOT be parsed as JSON
[error] Terminating websocket: :normal
[warning] Incoming message "this is\n" could NOT be parsed as JSON
[warning] Incoming message "not json\n" could NOT be parsed as JSON

Even after the websocket connection should have been terminated, we can still send messages to the server that will still be handled.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages