codeant-ai-for-open-source[bot] commented on code in PR #41003:
URL: https://github.com/apache/superset/pull/41003#discussion_r3531309354
##########
superset/mcp_service/composite_token_verifier.py:
##########
@@ -61,24 +63,31 @@ class CompositeTokenVerifier(TokenVerifier):
Bearer tokens are rejected at the transport layer (used when
``MCP_AUTH_ENABLED=False`` but ``FAB_API_KEY_ENABLED=True``).
api_key_prefixes: List of prefixes that identify API key tokens
- (e.g. ``["sst_"]``).
+ (e.g. ``["sst_"]``). Pass an empty list to disable API-key
+ acceptance (e.g. a guest-only deployment).
app: Flask application instance used to push an app context for
FAB SecurityManager access during token validation. When
``None``, prefix matching is used without DB validation
(backward-compatible / test mode).
+ guest_verifier: Optional verifier for Superset embedded guest tokens.
+ When provided, non-API-key tokens are offered to it BEFORE the JWT
+ verifier (guest tokens are signed with a different key and would
+ otherwise be rejected by the JWT verifier).
"""
def __init__(
self,
jwt_verifier: TokenVerifier | None,
api_key_prefixes: list[str],
app: Any = None,
+ guest_verifier: TokenVerifier | None = None,
) -> None:
super().__init__(
base_url=getattr(jwt_verifier, "base_url", None),
required_scopes=getattr(jwt_verifier, "required_scopes", None) or
[],
)
self._jwt_verifier = jwt_verifier
+ self._guest_verifier = guest_verifier
Review Comment:
**Suggestion:** Add an explicit type annotation for the new instance
attribute so the added verifier state is fully typed under the type-hinting
rule. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The new instance attribute is introduced in modified Python code and is
assignable an explicit type annotation (`TokenVerifier | None`). The custom
type-hint rule applies to relevant variables that can be annotated, so this is
a real violation.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=3689d3384fea444ea9c9f89a38e7a806&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=3689d3384fea444ea9c9f89a38e7a806&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/mcp_service/composite_token_verifier.py
**Line:** 90:90
**Comment:**
*Custom Rule: Add an explicit type annotation for the new instance
attribute so the added verifier state is fully typed under the type-hinting
rule.
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%2F41003&comment_hash=46dfdc53eba06699620f0e27e56b007cad6e01b28419179c1d515e48c3935e09&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41003&comment_hash=46dfdc53eba06699620f0e27e56b007cad6e01b28419179c1d515e48c3935e09&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]