gdg icon indicating copy to clipboard operation
gdg copied to clipboard

[BUG] Datasource download is missing basicAuthUser key in output json

Open sureshoss opened this issue 1 year ago • 1 comments

Describe the bug When we download a datasource which has the basicAuthUser feature enabled, the JSON output is missing the basicAuthUser, hence unable to reuse the downloaded output without making changes and its bot harder to manage on the git/source control

To Reproduce Steps to reproduce the behavior: Create a new datasource with basicAuthUser enabled Download the datasource using the gdg View the output json file in the output directory The output json will be missing the field basicAuthUser

Expected behavior When downloading the datasouce it should have the basicAuthUser field being added into the json

Desktop (please complete the following information):

  • GDG Version: [e.g. 0.1.10 output of gdg version]: 0.6.0
  • Grafana Version: [e.g. 8.3.6] 10.4.2
  • Configuration for Importer: default

sureshoss avatar May 14 '24 09:05 sureshoss

So, here's an example from the RAW API, bypassing anything GDG but this is an elasticsearch connection with basicAuth:

http://localhost:3000/api/datasources

  {
    "id": 3,
    "uid": "rg9qPqP7z",
    "orgId": 1,
    "name": "netsage",
    "type": "elasticsearch",
    "typeName": "Elasticsearch",
    "typeLogoUrl": "public/app/plugins/datasource/elasticsearch/img/elasticsearch.svg",
    "access": "proxy",
    "url": "https://netsage-elk1.grnoc.iu.edu/esproxy2/",
    "user": "",
    "database": "om-netsage-irnc-*",
    "basicAuth": true,
    "isDefault": true,
    "jsonData": {
      "esVersion": 70,
      "includeFrozen": false,
      "keepCookies": [],
      "logLevelField": "",
      "logMessageField": "",
      "maxConcurrentShardRequests": "256",
      "timeField": "start"
    },
    "readOnly": false
  },

The API doesn't seem to return the basicAuthUser any more. It has a 'user' field which is empty.

Getting each individual Connection by datasource does work, (Ex. http://localhost:3000/api/datasources/uid/rg9qPqP7z?accesscontrol=true ) but the question is ... what are you getting out of it?

You still need to map a connection to a username/password in an external file. Even if the user was set it would get obliterated by the secure file information which is intended to override the JSON values. Not to mention that replacing a single call with N number of calls is a bit heavy change just to add this field.

Can you expand on why you need this? I'm sure you're aware but the password would never be available from a download. You'd need to have that information, create a secure/credentials.json with the user/pass combination.

csg33k avatar May 14 '24 16:05 csg33k

I'm closing this issue. Feel free to re-open if you still have issues.

safaci2000 avatar Jun 19 '24 22:06 safaci2000