Review HTTPS use for global OpenAPI servers

Check that the default OpenAPI server addresses use HTTPS.

Description

Top-level servers lists the API’s default addresses. In OpenAPI 3.0, a missing or empty list defaults to / on the document host.

Potential impact

Clients that connect over HTTP expose credentials and data to interception or modification in transit.

Remediation

Enable HTTPS on the deployed servers and gateways. Use HTTPS URLs in servers and check that relative URLs and any path or operation overrides also resolve to HTTPS.

Examples

The example switches staging to HTTPS and adds the production server.

Before

json
{
  "openapi": "3.0.0",
  "servers": [
    {
      "url": "https://development.gigantic-server.com/v1"
    },
    {
      "url": "http://staging.gigantic-server.com/v1"
    }
  ]
}

After

json
{
  "openapi": "3.0.0",
  "servers": [
    {
      "url": "https://development.gigantic-server.com/v1"
    },
    {
      "url": "https://staging.gigantic-server.com/v1"
    },
    {
      "url": "https://api.gigantic-server.com/v1"
    }
  ]
}

References