Code Monkey home page Code Monkey logo

bandit-issue-173's Introduction

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.

bandit-issue-173's People

Contributors

janpieper avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.