Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseHTTPSettings can panic with incorrectly provisioned datasources #1149

Open
njvrzm opened this issue Nov 19, 2024 · 0 comments
Open

parseHTTPSettings can panic with incorrectly provisioned datasources #1149

njvrzm opened this issue Nov 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@njvrzm
Copy link
Contributor

njvrzm commented Nov 19, 2024

What happened:
A datasource was provisioned with string values instead of booleans in the jsonData. Incorrect types may be correctly interpreted by the Grafana UI - if it's expecting a bool, "false" and "true" are interpreted as bools; if it's expecting a string, it won't display anything for an int - but the sdk panics in parseHTTPSettings because there are unprotected type assertions that are violated.

What you expected to happen:
If jsonData settings are the wrong type, a meaningful error should be returned. (This should probably also happen in the UI, but it needs to happen here in any case.)

How to reproduce it (as minimally and precisely as possible):

  1. Provision a datasource with yaml - I tested with ElasticSearch.
  2. Include in the jsonData an incorrectly-typed setting, like tlsSkipVerify: "true" or basicAuthUser: 42
  3. Load the datasource and run "save and test"
  4. See the panic in the returned response

Environment:

  • SDK version: since v0.96.0
  • Grafana version: Probably any
@njvrzm njvrzm added the bug Something isn't working label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant