首页 > 解决方案 > Kibana 启用了您当前浏览器不符合的严格安全要求

问题描述

我想编写自动测试来测试kibana UI中是否有日志,并且我在使用java向kibana发送http请求时遇到问题。从浏览器中一切正常,但是当我从 Jsoup 库发送 HTTP 请求时(curl 也会发生同样的情况),kibana 向我显示以下内容:

Please upgrade your browser This Elastic installation has strict
security requirements enabled that your current browser does not meet.

看起来 kibana 正在执行一些易受攻击的 js,如果执行正确,它将停止加载 kibana UI。

  <script>
            // Since this is an unsafe inline script, this code will not run
            // in browsers that support content security policy(CSP). This is
            // intentional as we check for the existence of __kbnCspNotEnforced__ in
            // bootstrap.
            window.__kbnCspNotEnforced__ = true;
          </script>
  <script src="/bundles/app/kibana/bootstrap.js"></script> 

你知道如何从代码中解决这个问题吗?我认为可以从 kibana.yaml 禁用此安全功能,但我不想仅仅为了测试而禁用它。

标签: javaelasticsearchjsoupkibana

解决方案


我放弃了这种自动测试,但我想在这里回答一种可能的解决方案(我没有测试它,但它应该可以工作)。

您可以使用无头 Chrome 浏览器。它运行的是没有 UI 的 chrome 浏览器,可以与使用 selenium 库的 chrome 驱动程序一起使用。更多信息:https ://www.scrapingbee.com/blog/introduction-to-chrome-headless/


推荐阅读