codeant-ai-for-open-source[bot] commented on code in PR #43689:
URL: https://github.com/apache/superset/pull/43689#discussion_r3887488023
##########
superset/tasks/async_queries.py:
##########
@@ -125,6 +125,14 @@ def on_unsubscribe(
prefix = f"{principal}:"
return not any(existing.startswith(prefix) for existing in remaining)
+ def routing_channels(self, task: "CoreTask") -> list[str] | None:
+ # The consumer entries are exactly the per-tab realtime routing keys
+ # (`"<principal>:<tab_id>"` -> `realtime:<principal>:<tab_id>`), so a
+ # task-status message reaches only the tabs watching this task. Empty
->
+ # None so a chart task with no recorded tab (all detached, or a no-tab
+ # caller) falls back to principal-grain fanout instead of dropping it.
+ return self._consumers(task) or None
Review Comment:
**Suggestion:** The routing list is treated as authoritative without
checking current subscriber rows. A no-tab unsubscribe leaves the existing
per-tab entries intact while removing the principal subscriber, so a later
status transition can still be routed to sockets for a principal that is no
longer subscribed. Reconcile the recorded consumer entries with active
subscribers, or clear all entries for that principal when the principal-grain
unsubscribe path is used. [security]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Legacy cancellation leaves stale tab routing state.
- ⚠️ Unsubscribed tabs can receive task-status events.
- ⚠️ Task private properties retain obsolete consumer entries.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d7a72b13154f43dda93df6cc7b1e6e66&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=d7a72b13154f43dda93df6cc7b1e6e66&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/tasks/async_queries.py
**Line:** 134:134
**Comment:**
*Security: The routing list is treated as authoritative without
checking current subscriber rows. A no-tab unsubscribe leaves the existing
per-tab entries intact while removing the principal subscriber, so a later
status transition can still be routed to sockets for a principal that is no
longer subscribed. Reconcile the recorded consumer entries with active
subscribers, or clear all entries for that principal when the principal-grain
unsubscribe path is used.
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%2F43689&comment_hash=ce2a0f08f4a6705f1d314983ff91b774e2d89f28263c0cf1e39c26d703e9f49d&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43689&comment_hash=ce2a0f08f4a6705f1d314983ff91b774e2d89f28263c0cf1e39c26d703e9f49d&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]