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
28 stars 65 forks source link

[BUG] Cannot delete bad report instance created from bad report definition - makes UI for report instances unusable #955

Open UnbiasedGoat opened 7 months ago

UnbiasedGoat commented 7 months ago

What is the bug? One of our users created a report with the time range time format in the report definition creator set to a negative time which somehow was accepted

"format": { "duration": "PT-720H", "fileFormat": "Csv", "limit": 10000 }, "trigger": { "triggerType": "CronSchedule", "schedule": { "cron": { "expression": "40 7 *", "timezone": "Canada/Central" } } },

This saved somehow and created a bad report definition but also bad report instances. I can update the report definition but cannot fix the bad report instances. While they are in a bad state the ui 500s on error on the reports or report definition call or both with

{ "statusCode": 500, "error": "Internal Server Error", "message": "[report_params.core_params.time_duration]: invalid time duration: PT-720H" }

One can fix the report definition in the dev console by doing a put request but this is not possible for a report instance as they are not updatable.

How can one reproduce the bug? Steps to reproduce the behavior:

I'm not 100% sure but I think if you enter something like -4 in the relative time range when creating a report definition then click out it will still set it to that value even though it has a red validation must be greater than 0 - you can't hit enter though, it stops you from that, but clicking sets some value for sure.

What is the expected behavior? Would have expected it to not let us save and also to be able to fix the report instances which seems impossible - cannot overwrite the report instance or delete it (no method in api in /_opendistro/_reports/instance/{reportInstanceId}: ["GET","POST"] ) as POST is just for create new. Also cannot even delete the index it seems to have it re-generate - gives a no permissions error "type": "security_exception", "reason": "no permissions for [] and User.

Basically the UI for reports becomes unusable.

What is your host/environment? AWS Managed Opensearch Service - 2.9.

Do you have any screenshots? If applicable, add screenshots to help explain your problem.

Do you have any additional context?

Are there any workarounds? I couldn't seem to find any. I tried to modify or delete the reports / index to no avail.

UnbiasedGoat commented 7 months ago

Pretty sure the UI 400 error is addressed by https://github.com/opensearch-project/dashboards-reporting/pull/284

joshuali925 commented 6 months ago

i vaguely remember that we wanted to keep report instances for audit purposes so they are not deletable or mutable on purpose. I think https://github.com/opensearch-project/dashboards-reporting/pull/284 is probably a better fix for this

Before that fix gets released, in open source cluster they are deletable by superadmin (with the certs). For AWS you can reach their support