berlicon opened a new issue, #36592:
URL: https://github.com/apache/superset/issues/36592

   ### Bug description
   
   1. There is user1 with dataset1, chart1 and dashboard1. Dashboard1 based on 
chart1 which based on dataset1. Dataset1 points to Clickhouse table1.
   2. There is user2.
   3. I have enabled impersonation for user2 - e.g. I put: impersonate_user = 
true for user2 in dbs table of Superset DB.
   4. Both user1 and user2 has database access to Clickhouse table1. Both can 
run query in SQL Lab and get the results: select * from table1.
   5. User1 adds user2 as coowner of dataset1 in order to share dashboard1 to 
user2.
   6. User1 opens dashboard1 and click "Share/Copy permalink to clipboard".
   7. User2 opens permalink in browser and gets an error: DB::Exception: user2: 
Authentication failed: password is incorrect, or there is no user with such 
name.
   
   Actually the same issue was added before but it is still unresolved: 
https://github.com/apache/superset/issues/17074
   
   The route cause of the error in these rows 
(superset\db_engine_specs\base.py):
   if impersonate_user and username is not None:
       url = url.set(username=username)
   
   It seems in addition we should add rows like this:
       user = security_manager.find_user(username=username)
       url = url.set(password=user.password)
   
   ... But unfortunatelly, user.password contains encoded value like this:
   
scrypt:32768:8:1$iVy4M6mkGXr5y0AT$1b5eff974069e11d5e5d623d2d3428ed23cdfcb321167a9b7af2175b2e92c56cec16285cc9193edc9b1a1eda5638d7749c8b3fcf88fd4253ef4a41692f5d9e6f
   
   ... And I don't know how to decode it.
   
   I checked and add this row: 
       url = url.set(password='8i^hO$0g') # it is decoded value of password
   ... and user can load the dashboard. But decoded password I can see in this 
line (superset\models\core.py):
       effective_username = self.get_effective_user(sqlalchemy_url)
   
   here I can see decoded password in this variable: sqlalchemy_url.password
   ... but it happens when user loads his own dashboard.
   
   PS: My Superset version is 3.0, but I checked last version (6.0) and this 
bug is still unresolved.
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.9
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to