codeant-ai-for-open-source[bot] commented on code in PR #44705:
URL: https://github.com/apache/superset/pull/44705#discussion_r4111340817
##########
superset/db_engine_specs/databricks.py:
##########
@@ -446,7 +484,31 @@ def update_params_from_encrypted_extra(
logger.error(ex, exc_info=True)
raise
encrypted_extra.pop("oauth2_client_info", None)
+ secure_connect_args = encrypted_extra.pop("connect_args", None)
params.update(encrypted_extra)
+ if secure_connect_args is not None and not isinstance(
+ secure_connect_args, dict
+ ):
+ params["connect_args"] = secure_connect_args
+ return
+ if secure_connect_args is None and "connect_args" not in params:
+ return
+
+ secure_connect_args = secure_connect_args or {}
+ connect_args = dict(params.get("connect_args") or {})
+ if database.impersonate_user:
+ connect_args = {
+ key: value
+ for key, value in connect_args.items()
+ if key == "access_token"
+ or key not in DATABRICKS_SHARED_CREDENTIAL_CONNECT_ARGS
+ }
+ secure_connect_args = {
+ key: value
+ for key, value in secure_connect_args.items()
+ if key not in DATABRICKS_SHARED_CREDENTIAL_CONNECT_ARGS
Review Comment:
**Suggestion:** When the shared token exists only in encrypted extra,
`impersonate_user` never creates an `access_token` entry. This filter then
removes it, leaving the Python connector without the user's credential.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Security`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=020d42938bc241e9b8d7f18c4b044346&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=020d42938bc241e9b8d7f18c4b044346&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/databricks.py
**Line:** 506:509
**Comment:**
*Security: When the shared token exists only in encrypted extra,
`impersonate_user` never creates an `access_token` entry. This filter then
removes it, leaving the Python connector without the user's credential.
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%2F44705&comment_hash=a35a01ccf77cca558fcb6fb3da6b0ba9b52b681f5864a96287d95e05fbd52598&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44705&comment_hash=a35a01ccf77cca558fcb6fb3da6b0ba9b52b681f5864a96287d95e05fbd52598&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]