Skip to content
This repository was archived by the owner on Feb 2, 2022. It is now read-only.
This repository was archived by the owner on Feb 2, 2022. It is now read-only.

ZAP wrong endpoint URL #216

@Sticcia

Description

@Sticcia

Running ZAP in a local deployment with the following configuration:

{
  "readOnlyFileShareMounts": [
    {
      "fileShareName": "specifications",
      "mountPath": "/specifications"
    }
  ],
  "testTasks": {
    "targetConfiguration": {
      "apiSpecifications": [
        "/specifications/openapi.json"
      ],
      "endpoint": "https://<endpoint-url>/managementserver/rest"
    },
    "tasks": [
      {
        "toolName": "ZAP",
        "outputFolder": "zap",
        "keyVaultSecrets": [
          "TOKEN"
        ],
        "authenticationMethod": {
          "Token": "Token"
        }
      }
    ]
  }
}

The openapi.json specification contains the following:

"servers": [
  {
    "url": "https://localhost/ManagementServer/rest",
    "description": "Management Server entry point"
  }
]

Execution runs tests against URL from specification instead of endpoint in configuration, causing many errors like:

14529 [ZAP-Import-OpenAPI-1] WARN  org.zaproxy.zap.extension.openapi.ExtensionOpenApi - Failed to access URL: https://localhost/ManagementServer/rest/cameras : java.net.ConnectException : Connection refused (Connection refused)
14529 [ZAP-Import-OpenAPI-1] WARN  org.zaproxy.zap.extension.openapi.ExtensionOpenApi - Failed to access URL: https://localhost/ManagementServer/rest/cameras/id?tasks=tasks : java.net.ConnectException : Connection refused (Connection refused)
14529 [ZAP-Import-OpenAPI-1] WARN  org.zaproxy.zap.extension.openapi.ExtensionOpenApi - Failed to access URL: https://localhost/ManagementServer/rest/cameras/id?task=task : java.net.ConnectException : Connection refused (Connection refused)

This happens only when using a mounted file path for the specification.
Running a local python http.server on the host and changing the URL in the configuration to:

"apiSpecifications": [ "http://host.docker.internal:8000/openapi.json" ]

returns expected result.
Lastly, all other tools work with:

"apiSpecifications": [ "/specifications/openapi.json" ]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions