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

Password not replaced in SQLAlchemy URL when impersonation is enabled causing 401 Unauthorized #7170

Closed
nladuguie opened this issue Mar 29, 2019 · 5 comments
Labels
inactive Inactive for >= 30 days

Comments

@nladuguie
Copy link

Hi everybody, we use Superset to execute queries on a PrestoDB cluster.
We activated the impersonation feature on our PrestoDB connection, because we want to identify which user run which query just for auditing.
But when this feature is activated, all queries run result in a HTTP 401 error.
FYI, we have securized our PrestoDB cluster with SSL access and LDAP authentifcation, so PrestoDB URL configured in Superset includes basic authentication with user:password inside it (see attached image).
superset-presto-datasource

This error appears right after saving the Presto datasource with those configurations.
After debugging Superset execution, I observed that the impersonation features only replaces the username inside URL but not the password.
So in the resulting impersonated URL, the current user name is associated with the configured password in the datasource, which is not correct.

Superset version

0.28.1

Expected results

Run query with impersonation feature enabled should replace password (is specified) in the datasource URL, like username is.

Actual results

Queries are run with the current username in the datasource URL which has replaced the configured default username of the datasource URL, but the password in the URL remains the default one configure on the datasource.
The attached image shows the error resulting in saving the datasource after having activated the impersonation feature.
401-saving-presto-datasource

Steps to reproduce

Configure PrestoDB datasource with SSL and username/password configured (like shown in attached image), activate impersonation feature, and save the datasource.

@Ryan-Miao
Copy link

Ryan-Miao commented May 25, 2019

I just create database named hive-username for everyone by using username:password@host:port/hive, so the user can login, then choose the db with their name.

The disadvantage is that DB link needs to be maintained, but it does work.

You can try

{
"metadata_params": {},
"engine_params": { "connect_args":{"auth": "LDAP"} },
"metadata_cache_timeout": {},
"schemas_allowed_for_csv_upload": []
}

image

@stale
Copy link

stale bot commented Jul 24, 2019

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 Jul 24, 2019
@stale stale bot closed this as completed Jul 31, 2019
@haydenwhitehead
Copy link

I'm having the same problem with a PostgreSQL connection.
Once you enable "impersonate", the connection only works if the logged in user's password is the same as the database setup URI password.

@Asturias-sam
Copy link

@haydenwhitehead @nladuguie how you guys solved this issue facing similar issue #11359 ?

@tooptoop4
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

5 participants