opensearch-project / reporting

Export and automate PNG, PDF, and CSV reports in OpenSearch Dashboards
https://opensearch.org/docs/latest/dashboards/reporting/
Apache License 2.0
29 stars 66 forks source link

Unable to create report definition when using IPv6 network #1042

Open jpelletier412 opened 1 month ago

jpelletier412 commented 1 month ago

What is the bug? Error is thrown when attempting to create report definition in Opensearch-Dashboards GUI when on IPv6 network. We see this in the logs:

{
   "type":"log",
   "@timestamp":"2024-10-01T10:33:12Z",
   "tags":[
      "error",
      "plugins",
      "reportsDashboards"
   ],
   "pid":1,
   "message":"Failed input validation for create report definition ValidationError: [report_params.core_params.origin]: value must be a valid URI (see RFC 3986)."
}

I am not sure what this error is refering to as when I investigate the request in the browser, I dont see an "report_params.core_params.origin" field

{
   "report_params":{
      "report_name":"test1",
      "report_source":"Saved search",
      "description":"",
      "core_params":{
         "base_url":"/app/discover#/view/27895720-8f5f-11ec-b2f5-09d48915cf9c",
         "report_format":"csv",
         "time_duration":"PT30M",
         "saved_search_id":"27895720-8f5f-11ec-b2f5-09d48915cf9c",
         "limit":10000,
         "excel":true
      }
   },
   "delivery":{
      "configIds":[

      ],
      "title":"",
      "textDescription":"",
      "htmlDescription":""
   },
   "trigger":{
      "trigger_type":"On demand"
   }
}

The response in the logs seems to have correct formatted IPv6 addresses:

{
   "type":"response",
   "@timestamp":"2024-10-01T10:33:12Z",
   "tags":[

   ],
   "pid":1,
   "method":"post",
   "statusCode":400,
   "req":{
      "url":"/api/reporting/reportDefinition",
      "method":"post",
      "headers":{
         "host":"[330b:c0e0:101:5459:6936:2:1e0b:20d]",
         "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0",
         "accept":"*/*",
         "accept-language":"en-US,en;q=0.5",
         "accept-encoding":"gzip, deflate, br, zstd",
         "referer":"https://[330b:c0e0:101:5459:6936:2:1e0b:20d]/app/reports-dashboards",
         "content-type":"application/json",
         "osd-version":"2.14.0",
         "osd-xsrf":"osd-fetch",
         "content-length":"368",
         "origin":"https://[330b:c0e0:101:5459:6936:2:1e0b:20d]",
         "connection":"keep-alive",
         "sec-fetch-dest":"empty",
         "sec-fetch-mode":"cors",
         "sec-fetch-site":"same-origin",
         "priority":"u=0"
      },
      "remoteAddress":"330b:c0e0:101:5ec9:b433:2:c:0",
      "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0",
      "referer":"https://[330b:c0e0:101:5459:6936:2:1e0b:20d]/app/reports-dashboards"
   },
   "res":{
      "statusCode":400,
      "responseTime":5,
      "contentLength":9
   },
   "message":"POST /api/reporting/reportDefinition 400 5ms - 9.0B"
}

Generating report definition works fine in IPv4 network and defining server.host in opensearch-dashboards.yml as "0.0.0.0".

How can one reproduce the bug?

  1. Define server.host in opensearch-dashboards.yaml as "::"
  2. In Dashboards GUI, navigate to Plugins > Reporting
  3. Attempt to create a report defintion. Any settings will generate the error
  4. Notice error is raised and defintion is not created

What is the expected behavior? No error is occurrs when attempting to create a report definition when server.host is defined as "::"

What is your host/environment? Opensearch and Dashboards v2.14.0 Running using Docker images in Kuberntes environment Environment is running on IPv6 network opensearch-dashbaords.yml:

opensearch:
  hosts:
  -  https://app-service.svc.cluster.local:9200

  username: "user"
  password: "password"

  ssl:
    certificateAuthorities: [ "/secure/App/oauth-ca/oauth-ca.crt" ]

  requestHeadersAllowlist:
  - Authorization
  - securitytenant
  # Including old header name for backwards compatability
  - security_tenant

server:
  host: "::"

  ssl:
    enabled: true
    certificate: /secure/App/cert/cert
    key: /secure/App/cert/key

opensearch_security:
  auth:
    type: openid
  cookie:
    secure: true
    password: "secret"

  openid:
    connect_url: "https://oauth-service.svc.cluster.local/realms/App/.well-known/openid-configuration/"
    client_secret: "secret"
    client_id: "telemetry"
    root_ca: /secure/App/oauth-ca/oauth-ca.crt
    base_redirect_url: https://[330b:c0e0:101:5459:6936:2:1e0b:020d]/

  readonly_mode:
    roles:
    - kibana_read_only

  multitenancy:
    enabled: false

opensearchDashboards:
  autocompleteTimeout: 100000
  autocompleteTerminateAfter: 10000000
  branding:
    logo:
      defaultUrl: "https://[330b:c0e0:101:5459:6936:2:1e0b:020d]/ui/favicons/solidBackgroundLogo.png"
    mark:
      defaultUrl: "https://[330b:c0e0:101:5459:6936:2:1e0b:020d]/ui/favicons/transparentBackgroundLogo.png"
    loadingLogo:
      defaultUrl: "https://[330b:c0e0:101:5459:6936:2:1e0b:020d]/ui/favicons/transparentBackgroundLogo.png"
    faviconUrl: "https://[330b:c0e0:101:5459:6936:2:1e0b:020d]/ui/favicons/transparentBackgroundLogo.png"
    applicationTitle: "Application Telemetry"
dblock commented 2 weeks ago

[Catch All Triage - 1, 2]