Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Cannot export dashboards if password contains a "/" #134

Open
jake-low opened this issue May 3, 2019 · 0 comments
Open

Cannot export dashboards if password contains a "/" #134

jake-low opened this issue May 3, 2019 · 0 comments
Labels
Milestone

Comments

@jake-low
Copy link

jake-low commented May 3, 2019

Wizzy version: 0.5.9

I discovered this when attempting to export local dashboards to a Grafana instance using the username admin and a password containing a /, which for explanatory purposes let's pretend was pass/word. Setting the password to pass/word using wizzy set grafana and then trying to run wizzy export dashboards resulted in the following error:

# wizzy export dashboards
/app/node_modules/sync-request/index.js:37
    throw new Error(response.error.message || response.error || response);
    ^

Error: getaddrinfo ENOTFOUND admin admin:443
    at doRequest (/app/node_modules/sync-request/index.js:37:11)
    at /app/src/remote/grafana/exportSrv.js:197:20
    at arrayEach (/app/node_modules/lodash/lodash.js:537:11)
    at Function.forEach (/app/node_modules/lodash/lodash.js:9359:14)
    at Request.saveHandler [as _callback] (/app/src/remote/grafana/exportSrv.js:181:5)
    at Request.self.callback (/app/node_modules/request/request.js:186:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/app/node_modules/request/request.js:1163:10)
    at emitOne (events.js:115:13)

I suspected that this might be because the password is being used to construct a URL of the form https://user:password@hostname, and the password wasn't being URL-encoded. So I changed the password in Wizzy's config (but making no change in Grafana) from pass/word to pass%2Fword. This fixed the problem... for wizzy export dashboards. But it broke other commands, such as wizzy list dashboards, which worked before but now result in a 401 error:

# wizzy list dashboards
Grafana API response status code = 401
No error body from Grafana API.

I think this bug would be fixed by URL-encoding the password when constructing a URL that gets used in an API call somewhere beneath wizzy export dashboards. The desired behavior of course is for pass/word to work correctly for all commands, without the user having to think about percent-encoding weird characters.

Let me know if you need further details to reproduce this. And thanks for maintaining Wizzy! It's a really useful tool.

@Sytten Sytten added this to the 0.8.0 milestone Aug 9, 2019
@Sytten Sytten added the bug label Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants