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


##########
superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/constants.ts:
##########
@@ -90,6 +96,12 @@ export const FORM_FIELD_MAP = {
   warehouse: validatedInputField,
   role: validatedInputField,
   account: validatedInputField,
+  aws_access_key_id: validatedInputField,
+  aws_secret_access_key: validatedInputField,

Review Comment:
   **Suggestion:** `aws_secret_access_key` uses the generic visible input 
instead of the password-masking input, exposing the secret while entering or 
editing an Athena connection. [security]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=f5ecea43daee4d01895031cb04b5a8e8&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=f5ecea43daee4d01895031cb04b5a8e8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/constants.ts
   **Line:** 100:100
   **Comment:**
        *Security: `aws_secret_access_key` uses the generic visible input 
instead of the password-masking input, exposing the secret while entering or 
editing an Athena connection.
   
   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%2F44280&comment_hash=1eba6330a1d8966fcc54b1e9f769afcb2ef170d51b57dcd99676a20c989b39a8&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44280&comment_hash=1eba6330a1d8966fcc54b1e9f769afcb2ef170d51b57dcd99676a20c989b39a8&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/db_engine_specs/athena.py:
##########
@@ -190,3 +258,97 @@ def get_schema_from_engine_params(
             
awsathena+rest://athena.{region_name}.amazonaws.com:443/{schema_name}?catalog_name={catalog_name}&s3_staging_dir={s3_staging_dir}
         """
         return sqlalchemy_uri.database
+
+    @classmethod
+    def build_sqlalchemy_uri(
+        cls,
+        parameters: AthenaParametersType,
+        encrypted_extra: Optional[  # pylint: disable=unused-argument
+            dict[str, Any]
+        ] = None,
+    ) -> str:
+        query: dict[str, str] = {"s3_staging_dir": 
parameters["s3_staging_dir"]}

Review Comment:
   **Suggestion:** Existing URIs may contain `catalog_name`, but this builder 
only preserves staging and work-group parameters, so saving a dynamic-form 
connection silently loses its catalog. [api mismatch]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=cf66899faefd430595b4eb89e8930c69&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=cf66899faefd430595b4eb89e8930c69&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/db_engine_specs/athena.py
   **Line:** 270:270
   **Comment:**
        *Api Mismatch: Existing URIs may contain `catalog_name`, but this 
builder only preserves staging and work-group parameters, so saving a 
dynamic-form connection silently loses its catalog.
   
   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%2F44280&comment_hash=64afcf45af9c02ab390b084e4e1b61f7357b6ce17317442beec0346691d015a4&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44280&comment_hash=64afcf45af9c02ab390b084e4e1b61f7357b6ce17317442beec0346691d015a4&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/db_engine_specs/athena.py:
##########
@@ -190,3 +258,97 @@ def get_schema_from_engine_params(
             
awsathena+rest://athena.{region_name}.amazonaws.com:443/{schema_name}?catalog_name={catalog_name}&s3_staging_dir={s3_staging_dir}
         """
         return sqlalchemy_uri.database
+
+    @classmethod
+    def build_sqlalchemy_uri(
+        cls,
+        parameters: AthenaParametersType,
+        encrypted_extra: Optional[  # pylint: disable=unused-argument
+            dict[str, Any]
+        ] = None,
+    ) -> str:
+        query: dict[str, str] = {"s3_staging_dir": 
parameters["s3_staging_dir"]}
+        if work_group := parameters.get("work_group"):
+            query["work_group"] = work_group
+
+        # SQLAlchemy 2.0 made URL.__str__() hide the password by default
+        # (it rendered in full under 1.4); render_as_string(hide_password=
+        # False) is required here since this URI is stored/used to actually
+        # connect, not just displayed.
+        return URL.create(
+            f"{cls.engine}+{cls.default_driver}",
+            username=parameters.get("aws_access_key_id"),
+            password=parameters.get("aws_secret_access_key"),
+            host=f"athena.{parameters['region_name']}.amazonaws.com",

Review Comment:
   **Suggestion:** PrivateLink hosts are parsed as `region_name`, then this 
reconstruction prefixes them with `athena.` and produces an invalid endpoint 
when the connection is saved. [api mismatch]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=9bc3e6b9196b4cd28571fa9c8318e03d&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=9bc3e6b9196b4cd28571fa9c8318e03d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/db_engine_specs/athena.py
   **Line:** 282:282
   **Comment:**
        *Api Mismatch: PrivateLink hosts are parsed as `region_name`, then this 
reconstruction prefixes them with `athena.` and produces an invalid endpoint 
when the connection is saved.
   
   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%2F44280&comment_hash=f4e54e7b64cfde9540cc0ecea3724c399f0e280e1b7f64cc9951ca8b61d11d45&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44280&comment_hash=f4e54e7b64cfde9540cc0ecea3724c399f0e280e1b7f64cc9951ca8b61d11d45&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