Skip to content

Commit

Permalink
Fixes issue with specifications that don't have basePath set
Browse files Browse the repository at this point in the history
  • Loading branch information
andresriancho committed May 21, 2019
1 parent 9bf3f8c commit 251eeb0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion w3af/core/controllers/dependency_check/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
PIPDependency('diff_match_patch', 'diff-match-patch', '20121119'),

# OpenAPI documentation parser
PIPDependency('bravado_core', 'bravado-core', '5.0.2'),
PIPDependency('bravado_core', 'bravado-core', '5.12.1'),

# Fast compression library
PIPDependency('lz4', 'lz4', '1.1.0'),
Expand Down
4 changes: 3 additions & 1 deletion w3af/core/data/parsers/doc/open_api/specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ def _parse_spec_from_dict(self, spec_dict, retry=True):
:return: A Spec instance which holds all the dict information in an
accessible way.
"""
config = {'use_models': False}
config = {'use_models': False,
'use_spec_url_for_base_path': False}

if self.no_validation:
om.out.debug('Open API spec validation disabled')
config.update({
Expand Down
12 changes: 6 additions & 6 deletions w3af/core/data/parsers/doc/open_api/tests/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_no_params(self):
factory = RequestFactory(*data_i)
fuzzable_request = factory.get_fuzzable_request()

e_url = 'http://www.w3af.com/swagger.json/random'
e_url = 'http://www.w3af.com/random'
e_headers = Headers()

self.assertEqual(fuzzable_request.get_method(), 'GET')
Expand Down Expand Up @@ -152,7 +152,7 @@ def test_simple_int_param_in_path(self):
factory = RequestFactory(*data_i)
fuzzable_request = factory.get_fuzzable_request()

e_url = 'http://www.w3af.com/swagger.json/pets/42'
e_url = 'http://www.w3af.com/pets/42'
e_headers = Headers([('Content-Type', 'application/json')])

self.assertEqual(fuzzable_request.get_method(), 'GET')
Expand Down Expand Up @@ -248,7 +248,7 @@ def test_no_model_json_object_complex_nested_in_body(self):
factory = RequestFactory(*data_i)
fuzzable_request = factory.get_fuzzable_request()

e_url = 'http://www.w3af.com/swagger.json/pets'
e_url = 'http://www.w3af.com/pets'
e_headers = Headers([('Content-Type', 'application/json')])
e_data = ('{"pet": {"owner": {"name": {"last": "Smith", "first": "56"},'
' "address": {"postalCode": "90210", "street1": "Bonsai Street 123",'
Expand Down Expand Up @@ -334,7 +334,7 @@ def test_dereferenced_pet_store(self):
factory = RequestFactory(*data_i)
fuzzable_request = factory.get_fuzzable_request()

e_url = 'http://www.w3af.com/swagger.json/pets/John'
e_url = 'http://www.w3af.com/pets/John'
e_headers = Headers([('Content-Type', 'application/json')])
e_data = ''

Expand All @@ -351,7 +351,7 @@ def test_dereferenced_pet_store(self):
factory = RequestFactory(*data_i)
fuzzable_request = factory.get_fuzzable_request()

e_url = 'http://www.w3af.com/swagger.json/pets'
e_url = 'http://www.w3af.com/pets'
e_headers = Headers([('Content-Type', 'application/json')])
e_data = ''

Expand All @@ -368,7 +368,7 @@ def test_dereferenced_pet_store(self):
factory = RequestFactory(*data_i)
fuzzable_request = factory.get_fuzzable_request()

e_url = 'http://www.w3af.com/swagger.json/pets'
e_url = 'http://www.w3af.com/pets'
e_headers = Headers([('Content-Type', 'application/json')])
e_data = ('{"pet": {"owner": {"name": {"last": "Smith", "first": "56"},'
' "address": {"postalCode": "90210", "street1": "Bonsai Street 123",'
Expand Down

0 comments on commit 251eeb0

Please sign in to comment.