Incubator-superset: DB password special character bug

Created on 30 Jul 2020  路  5Comments  路  Source: apache/incubator-superset

When a special character '@' exists in the sqlalchemy URI it is not store correctly in superset metastore.

example URI:
postgresql://:123@456@:5432/

Expected results

escape the special character correctly after saving the Database entry

Actual results

what actually happens.

Screenshots

If applicable, add screenshots to help explain your problem.

How to reproduce the bug

  1. Go to Sources -> Datasources -> Create New
  2. Construct the URI and make sure the password has '@' character.
  3. Test Connection (Success)
  4. Save Datasource
  5. Open the newly created datasource
  6. Test Connection (Failed)

In this stage if you replace the password part ('XXXXXXXXXX') in the URI with the actual password its working correctly

Environment

  • superset version: 0.37.0rc1
#bug inactive

Most helpful comment

Side note: I had a recent conversation with one of our designers and he mentioned the idea of moving away from URIs and having a more complete form with different fields for each component of the URI. Maybe an "advanced" option let's you use the URI if you prefer. Then the UI would quote things for you.

All 5 comments

Thanks for the report @GiannisDimitriou - if you have a recommended code fix we'd be really excited!

@GiannisDimitriou the password needs to be entered pre-quoted. You can check what the password/username would be when quoted with the following snippet:

>>> from urllib.parse import quote_plus
>>> quote_plus('my@password/with!weird\characters')
'my%40password%2Fwith%21weird%5Ccharacters'

While it would be simple to perform this quoting automatically, current users are relying on the existing functionality. I can open a PR explaining how to properly quote username/password, unless you wish to that is!

Side note: I had a recent conversation with one of our designers and he mentioned the idea of moving away from URIs and having a more complete form with different fields for each component of the URI. Maybe an "advanced" option let's you use the URI if you prefer. Then the UI would quote things for you.

Side note: I had a recent conversation with one of our designers and he mentioned the idea of moving away from URIs and having a more complete form with different fields for each component of the URI. Maybe an "advanced" option let's you use the URI if you prefer. Then the UI would quote things for you.

@mistercrunch That's a very good idea, looking forward to help with requirement/testing if needed

@villebro Thanks for the snippet!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

Was this page helpful?
0 / 5 - 0 ratings