fix(backend): chat#296
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens ActivityPub chat federation handling to prevent authority confusion between local and remote chat rooms by introducing canonical room identity (URI/host) and updating inbox handlers and federation payloads accordingly, with regression tests.
Changes:
- Add
uriandhostcolumns tochat_roomand use them to resolve rooms safely in ActivityPub inbox flows. - Update chat federation rendering/sending to prefer the room’s canonical federation URI.
- Add unit regression tests covering cross-host spoofing, invitation requirements, and membership removal behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/backend/test/unit/ApInboxService.ts | Adds regression tests for chat federation authority/authorization edge cases. |
| packages/backend/src/models/ChatRoom.ts | Introduces uri/host columns and indexes for canonical remote-room identity. |
| packages/backend/src/core/ChatService.ts | Uses canonical room URI when emitting federation activities. |
| packages/backend/src/core/activitypub/ApRendererService.ts | Switches group-chat context and room object IDs to use canonical room URI when present. |
| packages/backend/src/core/activitypub/ApInboxService.ts | Adds safe room resolution by host/uri and enforces invitation/host checks in chat inbox handlers. |
| packages/backend/migration/1783194302667-AddChatRoomUriHost.js | Adds DB columns/indexes for room uri/host. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
이 PR에 의한 api.json 차이 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Why
Additional info (optional)
Checklist