KissPeter / APIFuzzer

Fuzz test your application using your OpenAPI or Swagger API definition without coding
GNU General Public License v3.0
416 stars 65 forks source link

Exception for max_length(0) < 0 for boolean fuzzer #67

Open abnair24 opened 10 months ago

abnair24 commented 10 months ago

Describe the bug

Below error observed on execution.

fuzzer_type: boolean fuzzer: RandomBitsField

94093 [ ERROR] APIFuzzer [fuzzer.py:47 - prepare ]: Exception: max_length(0) < 0 Traceback (most recent call last): File "~/.pyenv/versions/3.9.0/lib/python3.9/site-packages/apifuzzer/fuzzer.py", line 45, in prepare template_generator.process_api_resources() File "~/.pyenv/versions/3.9.0/lib/python3.9/site-packages/apifuzzer/openapi_template_generator.py", line 110, in process_api_resources self._process_api_resources() File "~/.pyenv/versions/3.9.0/lib/python3.9/site-packages/apifuzzer/openapi_template_generator.py", line 252, in _process_api_resources fuzz_type( File "~/.pyenv/versions/3.9.0/lib/python3.9/site-packages/apifuzzer/custom_fuzzers.py", line 112, in init super(RandomBitsField, self).init( File "~/.pyenv/versions/3.9.0/lib/python3.9/site-packages/kitty/model/low_level/field.py", line 1114, in init self._validate_lengths(min_length, max_length) File "~/.pyenv/versions/3.9.0/lib/python3.9/site-packages/kitty/model/low_level/field.py", line 1135, in _validate_lengths raise KittyException('max_length(%d) < 0' % (max_length)) kitty.core.KittyException: max_length(0) < 0 Unexpected exception happened during fuzz test preparation: max_length(0) < 0. Feel free to report the issue

APIFuzzer debug log

Please provide the related APIFuzzer debug log

Related API definition

Please provide only the minimal but valid API definition which causes the issue

Software environment (please complete the following information):

Additional context

Add any other context about the problem here.

KissPeter commented 10 months ago

Can you provide a snippet from the API definition causing this?

abnair24 commented 10 months ago

@KissPeter Pls find the below header from the apispec which causing the issue


"parameters":[ {
            "name": "ENABLE-DEBUG",
            "in": "header",
            "description": "ENABLE-DEBUG",
            "required": true,
            "schema": {
              "type": "boolean"
            }
          }]```