fix: bind channel thread parent/reply to the URL channel (#25766)
GET /api/v1/channels/{id}/messages/{message_id}/thread authorized only the URL channel, but get_messages_by_parent_id() appended the thread parent (loaded by id) without checking it belonged to that channel, so a caller could read a message from a channel they cannot access by passing its id as the thread root. Require the parent to be in the requested channel before returning it, and reject a posted parent_id/reply_to_id that does not belong to the channel.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
7b1aa749eb
commit
a66477b710
@@ -328,7 +328,8 @@ class MessageTable:
|
||||
async with get_async_db_context(db) as db:
|
||||
message = await db.get(Message, parent_id)
|
||||
|
||||
if not message:
|
||||
# Thread parent must belong to the requested channel; never disclose a foreign-channel message.
|
||||
if not message or message.channel_id != channel_id:
|
||||
return []
|
||||
|
||||
result = await db.execute(
|
||||
|
||||
Reference in New Issue
Block a user