Skip to content

running deepstate with config file -> types recognition bug #311

Open
@GrosQuildu

Description

@GrosQuildu

Deepstate allows to use config file instead of command line arguments:

parser.add_argument(
"-c", "--config", type=str,
help="Configuration file to be consumed instead of arguments.")

if args.config:
_args.update(cls.build_from_config(args.config)) # type: ignore

parser = configparser.SafeConfigParser()
parser.read(config)

For parsing uses configparser. But the lib doesn't recognize daty types. So if we specify i.e. timeout = 36000 it will be parsed as string and crash fuzzers at startup:

stdout, stderr = self.proc.communicate(timeout=self.timeout if self.timeout != 0 else None)

Traceback (most recent call last):
  File "~/.virtualenvs/deepstate/lib/python3.7/site-packages/deepstate-0.1-py3.7.egg/deepstate/core/fuzz.py", line 479, in _run
    stdout, stderr = self.proc.communicate(timeout=self.timeout if self.timeout != 0 else None)
  File "/usr/lib/python3.7/subprocess.py", line 934, in communicate
    endtime = _time() + timeout
TypeError: unsupported operand type(s) for +: 'float' and 'str'

Found when tried to run https://github.com/trailofbits/deepstate-test-suite/blob/master/tests/json/config.ini

We may switch to different config file format (YAML?) or, probably better, use argparse to recognize types of arguments we pull from config file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions