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

DB password special character bug #10483

Closed
GiannisDimitriou opened this issue Jul 30, 2020 · 14 comments
Closed

DB password special character bug #10483

GiannisDimitriou opened this issue Jul 30, 2020 · 14 comments
Labels
!deprecated-label:bug Deprecated label - Use #bug instead

Comments

@GiannisDimitriou
Copy link

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
@GiannisDimitriou GiannisDimitriou added the !deprecated-label:bug Deprecated label - Use #bug instead label Jul 30, 2020
@willbarrett
Copy link
Member

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

@villebro
Copy link
Member

villebro commented Aug 5, 2020

@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!

@mistercrunch
Copy link
Member

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.

@GiannisDimitriou
Copy link
Author

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!

@stale
Copy link

stale bot commented Oct 12, 2020

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.

@stale stale bot added the inactive Inactive for >= 30 days label Oct 12, 2020
@priteshwatch
Copy link

Hello, is there an update on this . my password has an asterix. I would atleast love to get a work around.

postgresql+psycopg2://test:test123**@play-domain.1.rds.amazonaws.com:5432/keymakerdb

@stale stale bot removed the inactive Inactive for >= 30 days label Feb 25, 2021
@priteshwatch
Copy link

If I just escape the password, it works at connection time but does not recognize the password post connection. so essentially unusable.

@junlincc
Copy link
Member

junlincc commented Mar 31, 2021

related #13456
#12034

@rajeshd-coditation
Copy link

Any workaround here?

@rajeshd-coditation
Copy link

For now - changed type of password field from being EncryptedType to String in superset/models/core.py

Before anyone uses this approach - please consider security risk here. I'm doing it for POC purposes.

@clgcn
Copy link

clgcn commented Oct 8, 2021

Same issue, our password contain %
We got error as below:
ValueError: invalid interpolation syntax in 'postgresql+psycopg2://username:xxx!xxx%@localhost:5432/superset' at position 56

@kaykumar
Copy link

kaykumar commented Nov 5, 2021

same here, if password or username has '@' it does not seems to be working.

@villebro
Copy link
Member

villebro commented Nov 5, 2021

Did you try escaping the password string as explained above?

@kaykumar
Copy link

I was able to make it work via replacing the special character with url encode value.

example: "pass@word" should be changed to "pass%40word" in SQLALCHEMY URI* field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead
Projects
None yet
Development

No branches or pull requests

9 participants