Skip to content

Crash in mitmproxy command when editing a float option added by an addon #4926

Open

Description

@triztian

Problem Description

Addons that add_option with float types cause a crash. Based on the documentation the float type is listed as supported.

StackTrace
Traceback (most recent call last):
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/master.py", line 54, in run_loop
    loop()
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/main_loop.py", line 287, in run
    self._run()
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/main_loop.py", line 385, in _run
    self.event_loop.run()
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/main_loop.py", line 1494, in run
    reraise(*exc_info)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/compat.py", line 58, in reraise
    raise value
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/raw_display.py", line 416, in 
    wrapper = lambda: self.parse_input(
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/raw_display.py", line 515, in parse_input
    callback(processed, processed_codes)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/main_loop.py", line 412, in _update
    self.process_input(keys)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/main_loop.py", line 513, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/tools/console/window.py", line 318, in keypress
    return self.master.keymap.handle(
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/tools/console/keymap.py", line 145, in handle
    return self.executor(b.command)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/tools/console/commandexecutor.py", line 18, in __call__
    ret = self.master.commands.execute(cmd)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/command.py", line 273, in execute
    return self.call_strings(command_name, args)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/command.py", line 259, in call_strings
    return self.commands[command_name].call(args)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/command.py", line 129, in call
    ret = self.func(*bound_args.args, **bound_args.kwargs)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/command.py", line 303, in wrapper
    return function(*args, **kwargs)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/tools/console/consoleaddons.py", line 164, in nav_select
    self.master.inject_key("m_select")
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/tools/console/master.py", line 186, in inject_key
    self.loop.process_input([key])
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/main_loop.py", line 513, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/tools/console/window.py", line 316, in keypress
    k = super().keypress(size, k)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/container.py", line 1135, in keypress
    return self.body.keypress( (maxcol, remaining), key )
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/tools/console/window.py", line 50, in keypress
    ret = super().keypress(size, key)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/urwid/container.py", line 1135, in keypress
    return self.body.keypress( (maxcol, remaining), key )
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/tools/console/options.py", line 290, in keypress
    return self.focus_item.keypress(tsize, key)
  File "/Users/triztian/.pyenv/versions/3.9.4/lib/python3.9/site-packages/mitmproxy/tools/console/options.py", line 230, in keypress
    raise NotImplementedError()
NotImplementedError

mitmproxy has crashed!
Please lodge a bug report at:
https://github.com/mitmproxy/mitmproxy/issues

Steps to reproduce the behavior:

Create an addon file called floatoption.mitm.py with the following content:

class FloatOptions:
    def load(self, loader):
        loader.add_option(
                name="FloatOption",
                typespec=float,
                default=0.0,
                help="Testing"
        )

addons = [FloatOptions()]

Then start mitmproxy like this mitmproxy -s floatoption.mitm.py press shft+o to open the options editing view and select the
FloatOption option the crash should happen.

mitmproxy float crash

System Information

Mitmproxy: 7.0.4
Python:    3.9.4
OpenSSL:   OpenSSL 1.1.1l  24 Aug 2021
Platform:  macOS-11.6.1-x86_64-i386-64bit

Activity

  1. added
    kind/triage
    on Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions