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


##########
superset/models/core.py:
##########
@@ -708,7 +714,14 @@ def _get_sqla_engine(  # pylint: disable=too-many-locals  
# noqa: C901
         if cacheable and self.id is not None:
             cache_key = (
                 self.id,
-                str(sqlalchemy_url),
+                # SQLAlchemy 2.0 changed str(URL) to always substitute
+                # "***" for the password rather than rendering the real
+                # value (str(url) under 1.4). Using it here would make
+                # the cache key blind to password rotation - the module
+                # comment above depends on the key changing when the
+                # password does, so render_as_string(hide_password=False)
+                # is required to preserve that behavior.
+                sqlalchemy_url.render_as_string(hide_password=False),

Review Comment:
   **Suggestion:** Putting the unmasked SQLAlchemy URL in the global 
engine-cache key retains the database password as a long-lived dictionary key 
in `_ENGINE_CACHE`. This creates an additional plaintext secret copy that can 
be exposed through memory inspection, debugging, cache diagnostics, or 
accidental key logging. Derive a password-rotation-sensitive key from a 
non-reversible digest or another secret-free representation instead of 
embedding the credential itself. [security]
   
   <details>
   <summary><b>Severity Level:</b> Minor ๐Ÿงน</summary>
   
   ```mdx
   - โš ๏ธ Saved database passwords persist in process cache keys.
   - โš ๏ธ Memory inspection exposes an unnecessary credential copy.
   - โš ๏ธ No repository path logs `_ENGINE_CACHE` keys.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=3225e57e3fb24353b5b7fa4f85e1366b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=3225e57e3fb24353b5b7fa4f85e1366b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <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:** 724:724
   **Comment:**
        *Security: Putting the unmasked SQLAlchemy URL in the global 
engine-cache key retains the database password as a long-lived dictionary key 
in `_ENGINE_CACHE`. This creates an additional plaintext secret copy that can 
be exposed through memory inspection, debugging, cache diagnostics, or 
accidental key logging. Derive a password-rotation-sensitive key from a 
non-reversible digest or another secret-free representation instead of 
embedding the credential itself.
   
   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.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42803&comment_hash=0ba55165e75670cb80e3f96c82fb0022143d4e2f208a1a5d0905725504eb0953&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42803&comment_hash=0ba55165e75670cb80e3f96c82fb0022143d4e2f208a1a5d0905725504eb0953&reaction=dislike'>๐Ÿ‘Ž</a>



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