ysinghc opened a new pull request, #36783:
URL: https://github.com/apache/superset/pull/36783

   ### SUMMARY
   
   Fixes a critical bug where database connection passwords containing special 
characters fail to connect due to improper URL encoding handling in the 
`sqlalchemy_uri_decrypted` property.
   
   **Root Cause:**
   The `Database.sqlalchemy_uri_decrypted` property used `str(conn)` to convert 
SQLAlchemy URL objects to strings, which loses percent encoding during the 
conversion.
   
   **Solution:**
   1. Pre-encode the raw password using `urllib.parse.quote(safe="")` to ensure 
special characters are properly encoded
   2. Set the encoded password in the URL object: 
`conn.set(password=encoded_password)`
   3. Use `conn.render_as_string(hide_password=False)` instead of `str(conn)` 
to preserve the URL encoding
   
   This ensures passwords with special characters survive the encode -> store 
-> decode -> parse cycle without data loss.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   ### TESTING INSTRUCTIONS
   
   1. Unit Test:
   ```bash
   pytest tests/unit_tests/models/test_core_database_password_encoding.py -v
   ```
   
   2. Integration Test:
   ```bash
   pytest tests/integration_tests/test_database_password_encoding.py -v
   ```
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: #36328
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


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