codeant-ai-for-open-source[bot] commented on code in PR #36783:
URL: https://github.com/apache/superset/pull/36783#discussion_r2638093355


##########
superset/models/core.py:
##########
@@ -1149,20 +1149,36 @@ def get_schema_access_for_file_upload(  # pylint: 
disable=invalid-name
 
     @property
     def sqlalchemy_uri_decrypted(self) -> str:
+        """Return the decrypted SQLAlchemy URI with properly encoded 
password."""
         try:
             conn = make_url_safe(self.sqlalchemy_uri)
         except DatabaseInvalidError:
             # if the URI is invalid, ignore and return a placeholder url
             # (so users see 500 less often)
             return "dialect://invalid_uri"
+
+        # Determine plaintext password from config or model
         if has_app_context():
             if custom_password_store := 
app.config["SQLALCHEMY_CUSTOM_PASSWORD_STORE"]:

Review Comment:
   **Suggestion:** Type/error bug: 
`app.config["SQLALCHEMY_CUSTOM_PASSWORD_STORE"]` is accessed and then called 
without verifying it's present and callable; if the config key is missing or is 
not a callable this will raise KeyError or TypeError. Use `app.config.get(...)` 
and `callable()` to guard the call. [type error]
   
   **Severity Level:** Minor ⚠️
   ```suggestion
               custom_password_store = 
app.config.get("SQLALCHEMY_CUSTOM_PASSWORD_STORE")
               if callable(custom_password_store):
   ```
   <details>
   <summary><b>Why it matters? ⭐ </b></summary>
   
   Accessing app.config[...] can raise KeyError and calling a non-callable 
value can raise TypeError. Using app.config.get(...) and verifying 
callable(custom_password_store) is a small, correct hardening that prevents 
surprising exceptions when the config isn't set or is misconfigured. It's a 
low-impact, valid robustness improvement for this property.
   </details>
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/models/core.py
   **Line:** 1162:1162
   **Comment:**
        *Type Error: Type/error bug: 
`app.config["SQLALCHEMY_CUSTOM_PASSWORD_STORE"]` is accessed and then called 
without verifying it's present and callable; if the config key is missing or is 
not a callable this will raise KeyError or TypeError. Use `app.config.get(...)` 
and `callable()` to guard the call.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   ```
   </details>



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