microsoft / restler-fuzzer

RESTler is the first stateful REST API fuzzing tool for automatically testing cloud services through their REST APIs and finding security and reliability bugs in these services.
MIT License
2.52k stars 283 forks source link

Fuzz-lean error,Cannot import grammar: 'NoneType' object has no attribute 'loader' #859

Open painsAgains opened 4 months ago

painsAgains commented 4 months ago

Description

Error description

When I run a command like ‘dotnet ..\restler_bin\restler\Restler.dll fuzz-lean --grammar_file .\Compile\grammar.json --dictionary_file .\Compile\dict.json --settings .\Compile\engine_settings.json --token_refresh_command "python ..\auth\xx.py" --token_refresh_interval 720’ , I got some problem: ERROR: Restler engine failed.See logs in xxx directory for more information. Task FuzzLean failed. And then I checked the "EngineStdErr.txt", it is empty, but "EngineStdOut.txt" shows Cannot import grammar: 'NoneType' object has no attribute 'loader'. I also checked the "restler-xx-xx.log" content, I found the error was happened when executed the command python.exe -B "xx\restler\restler-fuzzer\restler_bin\restler\../engine/restler.py" --restler_grammar "xx\restler\restler-fuzzer\gitlab\Compile\grammar.json" --custom_mutations "xx\restler\restler-fuzzer\gitlab\Compile\dict.json" --set_version 9.2.3 --token_refresh_interval 720 --token_refresh_cmd "python ..\auth\gitlab_auth.py" --settings "xx\restler\restler-fuzzer\gitlab\Compile\engine_settings.json" --enable_checkers * --disable_checkers namespacerule --include_user_agent --no_tokens_in_logs t --garbage_collection_interval 30 --fuzzing_mode directed-smoke-test exited with code: -1 So I'm guessing it's due to a problem with the openapi specification, but I don't know exactly what the problem is. I really hope someone can help me. This is my specification address: https://api.apis.guru/v2/specs/gitlab.com/v3/swagger.json

painsAgains commented 4 months ago

Now, I tested another specification and also got this error,so I thought the error is not due to specification.It is maybe due to grammar.json,but I compiled the specification successful, so I don't kown which part I made mistake

s0metea commented 3 months ago

I faced a similar problem when passing grammar.json instead grammar.py to --grammar_file parameter. So instead --grammar_file .\Compile\grammar.json" It should be --grammar_file .\Compile\grammar.py"