elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.63k stars 8.22k forks source link

[Watcher]: Simulation freezes Kibana UI when using http input using, a condition ctx.payload._status_code and SSL negotiation fails #180042

Open miguelsantosalvarez opened 7 months ago

miguelsantosalvarez commented 7 months ago

Kibana version: It happens at least in Kibana 8.12 and 8.8. There were the versions I tested it.

Describe the bug: When simulating one specific watcher that uses as input plugin . If you evaluate as a condition the value received as: ctx.payload._status_code, but the HTTP connection doesn't occur, for ie when using and HTTPS endpoint with self signed certs. The UI get frozen. Elasticsearch logs the error:

...
{"@timestamp":"2024-04-04T09:47:23.214Z", "log.level":"ERROR", "message":"failed to execute [http] input for watch [_inlined_]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[elasticsearch-es-default-0][watcher][T#1]","log.logger":"org.elasticsearch.xpack.watcher.input.http.ExecutableHttpInput","trace.id":"32714392b253d5898d23a23804ed1f4c","elasticsearch.cluster.uuid":"Bylg4jNVQjmyMdMb3TaPug","elasticsearch.node.id":"VPL7MixpTrq_L69mi8EAXA","elasticsearch.node.name":"elasticsearch-es-default-0","elasticsearch.cluster.name":"elasticsearch","error.type":"javax.net.ssl.SSLHandshakeException","error.message":"PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target" ...

Kibana didn't log anything related to the error and stays unresponsive. Steps to reproduce: You can try to reproduce it with the following watcher:

{
  "trigger": {
    "schedule": {
      "daily": {
        "at": [
          "05:00"
        ]
      }
    }
  },
  "input": {
    "http": {
      "request": {
        "scheme": "https",
        "host": "self-signed.badssl.com",
        "port": 443,
        "method": "get",
        "path": "/",
        "params": {},
        "headers": {}
      }
    }
  },
  "condition": {
    "compare": {
      "ctx.payload._status_code": {
        "lt": 400
      }
    }
  },
  "actions": {
    "reporting-triggered-logging": {
      "logging": {
        "level": "info",
        "text": "This is my code at '{{ctx.payload._status_code}}'"
      }
    }
  }
}

Expected behavior: Displaying an error in Kibana UI

elasticmachine commented 7 months ago

Pinging @elastic/kibana-reporting-services (Team:Reporting Services)

tsullivan commented 3 months ago

Removing the Team:Reporting Services label as this issue doesn't seem to have anything to do with the handling of POST URLs in Watches.

elasticmachine commented 3 months ago

Pinging @elastic/kibana-management (Team:Kibana Management)