Server URL must be an absolute URL

Description

The property url of the server object must be an absolute URL.

The Open API Specification (OAS) states that a server object may have a relative URL but that this indicates that the host location is relative to the location where the OpenAPI document is being served. Because API definitions are uploaded to 42Crunch Platform, not retrieved from URLs, Security Audit cannot infer the host location and thus relative URLs are not acceptable.

For more details, see the OpenAPI Specification.

Example

The following is an example of how this issue could look in your API definition. The server object has been defined, but as a relative URL:

1openapi: 3.0.0
2servers:
3  - url: /api
4info:
5  {}
6  # ...
7

Remediation

Define the URL of the server object as an absolute URL.

1openapi: 3.0.0
2servers:
3  - url: http://petstore.swagger.io/api
4info:
5  {}
6  # ...
7

Copyright 42Crunch 2021