codeant-ai-for-open-source[bot] commented on code in PR #45894:
URL: https://github.com/apache/superset/pull/45894#discussion_r4426519980
##########
superset/core/api/core_api_injection.py:
##########
@@ -23,17 +23,52 @@
to be used with direct imports while maintaining loose coupling.
"""
+from functools import wraps
from typing import Any, Callable, TYPE_CHECKING, TypeVar
from sqlalchemy.orm import scoped_session
-from superset.extensions.context import get_current_extension_context
+from superset.extensions.context import (
+ extension_context,
+ get_current_extension_context,
+)
+from superset.utils.core import get_user_id
if TYPE_CHECKING:
from superset_core.common.models import Database
+ from superset_core.extensions.types import Manifest
from superset_core.rest_api.api import RestApi
+def _contextualize_extension_api(
+ api_class: type["RestApi"],
+ manifest: "Manifest",
+) -> None:
+ """Execute exposed extension API methods with extension and user
context."""
+ for attribute_name, attribute in vars(api_class).items():
Review Comment:
**Suggestion:** Inherited exposed handlers are skipped, so registered routes
can run without extension context; calls to `get_context()` then fail and
user-scoped secrets lack the principal.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Api mismatch`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=47fd419109f14724931b169791064dfe&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=47fd419109f14724931b169791064dfe&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/core/api/core_api_injection.py
**Line:** 48:48
**Comment:**
*Api Mismatch: Inherited exposed handlers are skipped, so registered
routes can run without extension context; calls to `get_context()` then fail
and user-scoped secrets lack the principal.
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%2F45894&comment_hash=4c7b252031163f680dbdea22ea0bdddd7b4b8f94fc01b0127c6e1c9f3d128947&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45894&comment_hash=4c7b252031163f680dbdea22ea0bdddd7b4b8f94fc01b0127c6e1c9f3d128947&reaction=dislike'>๐</a>
##########
superset/extensions/storage/persistent_dao.py:
##########
@@ -152,17 +158,47 @@ def _enc_type(user_fk: int | None) -> EncryptedType:
Shared rows (user_fk=None) use SECRET_KEY directly.
"""
secret = current_app.config["SECRET_KEY"]
- key = _derive_key(secret, user_fk) if user_fk is not None else secret
+ key = derive_user_key(secret, user_fk) if user_fk is not None else secret
Review Comment:
**Suggestion:** Older user-scoped encrypted rows use `SECRET_KEY`, so this
changes their decryption key; reads fail and silently return `None` after
upgrade.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Logic error`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b4a6437653ac4fe0bd60c2edc6f02b4a&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=b4a6437653ac4fe0bd60c2edc6f02b4a&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/extensions/storage/persistent_dao.py
**Line:** 161:161
**Comment:**
*Logic Error: Older user-scoped encrypted rows use `SECRET_KEY`, so
this changes their decryption key; reads fail and silently return `None` after
upgrade.
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%2F45894&comment_hash=edb02aac4c273a5fe0a97fed0e987ca742ddcf174c28ece0dcf12166ed0353bf&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45894&comment_hash=edb02aac4c273a5fe0a97fed0e987ca742ddcf174c28ece0dcf12166ed0353bf&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]