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

[bug] Fix CSV upload feature for DB with password #4562

Merged
merged 3 commits into from
Mar 8, 2018
Merged

[bug] Fix CSV upload feature for DB with password #4562

merged 3 commits into from
Mar 8, 2018

Conversation

ktravis
Copy link
Contributor

@ktravis ktravis commented Mar 7, 2018

As of #4298, the call to create_engine within create_table_from_csv located here is using sqlalchemy_uri to create a new SQLAlchemy engine. This works as expected if the URI does not contain a password - however if it does, this string contains the masked password (i.e. XXXXXXXX), and authentication is attempted using that instead.

This change should fix #4285 and #4287.

@codecov-io
Copy link

codecov-io commented Mar 7, 2018

Codecov Report

Merging #4562 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #4562   +/-   ##
======================================
  Coverage    71.2%   71.2%           
======================================
  Files         187     187           
  Lines       14786   14786           
  Branches     1083    1083           
======================================
  Hits        10528   10528           
  Misses       4255    4255           
  Partials        3       3
Impacted Files Coverage Δ
superset/db_engine_specs.py 52.25% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b63dc91...63ea6e4. Read the comment docs.

@john-bodley
Copy link
Member

john-bodley commented Mar 7, 2018

cc: @mistercrunch @timifasubaa

@john-bodley
Copy link
Member

john-bodley commented Mar 7, 2018

@ktravis could you also try testing this change with replacing root@localhost here with mysqluser:mysqluserpassword.

tox.ini Outdated
@@ -82,7 +82,7 @@ commands =
[testenv:py27-mysql]
basepython = python2.7
setenv =
SUPERSET__SQLALCHEMY_DATABASE_URI = mysql://root@localhost/superset?charset=utf8
SUPERSET__SQLALCHEMY_DATABASE_URI = mysql://mysqluser:mysqluserpassword@localhost/superset
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you'll still need the ?charset=utf8 suffix as Python 2.7 uses ASCII by default.

@ktravis
Copy link
Contributor Author

ktravis commented Mar 7, 2018

@john-bodley done, thanks

@timifasubaa
Copy link
Contributor

LGTM
Thanks for fixing this @ktravis !

@john-bodley
Copy link
Member

john-bodley commented Mar 7, 2018

@mistercrunch would you mind taking a look at this? I just want to be sure there's no risk of leaking the decrypted URI.

@timifasubaa
Copy link
Contributor

Afaik, that's the lowest level we can use the unencrypted password and it goes directly into the creation of the db_engine. I doubt there is any chance for leakage. Curious to hear what Max thinks

@mistercrunch
Copy link
Member

LGTM

@mistercrunch mistercrunch merged commit 31a9957 into apache:master Mar 8, 2018
@ktravis ktravis deleted the fix-csv-upload branch March 8, 2018 13:58
aqia358 pushed a commit to aqia358/incubator-superset that referenced this pull request Mar 8, 2018
* Use sqlalchemy_uri_decrypted in create_engine calls

* Update tox mysql uri

* Include mysql charset=utf8 for py2.7 in tox.ini
john-bodley pushed a commit to john-bodley/superset that referenced this pull request Apr 10, 2018
* Use sqlalchemy_uri_decrypted in create_engine calls

* Update tox mysql uri

* Include mysql charset=utf8 for py2.7 in tox.ini

(cherry picked from commit 31a9957)
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
* Use sqlalchemy_uri_decrypted in create_engine calls

* Update tox mysql uri

* Include mysql charset=utf8 for py2.7 in tox.ini
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
* Use sqlalchemy_uri_decrypted in create_engine calls

* Update tox mysql uri

* Include mysql charset=utf8 for py2.7 in tox.ini
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.24.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.24.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import CSV File Into PosgreSQL Table. Error: password authentication failed
5 participants