-
Notifications
You must be signed in to change notification settings - Fork 12
Use a single room per server-user pair for events #3910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
IanCal
wants to merge
53
commits into
main
Choose a base branch
from
cs-9552-refactor-realm-event-sending-to-use-realm-server-session
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+351
−414
Open
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
a72e992
Don't link to staging
IanCal fd6228f
Simplify setup to require a single session room for all comms
IanCal d920670
Add realm url to indexing events
IanCal 505c1e5
Merge branch 'main' into cs-9552-refactor-realm-event-sending-to-use-…
IanCal 7bc0935
Remove username from publishing realm
IanCal 7cd147b
Remove console logging
IanCal 789ce5c
Merge branch 'main' into cs-9552-refactor-realm-event-sending-to-use-…
IanCal 02f9b25
Pass through matrix client in tests setup too
IanCal 45d3741
Merge branch 'main' into cs-9552-refactor-realm-event-sending-to-use-…
IanCal 0d138a1
Update scheme and move migration to be the last
IanCal 2854b71
Explicitly expect two files to be attached
IanCal cfbbae5
Don't auto-login to realm
IanCal 10aaba6
Add the hard coded realm user to have read permissions
IanCal 0740430
Session rooms are created automatically, do not create them in tests
IanCal 01b7c9f
Update permissions in tests
IanCal 6a2a5bd
Use the realm user id to get the session rooms for sending events
IanCal e811ac5
Info overwriting removed, correct realm url
IanCal cc60f93
Remove accidental test.only
IanCal 036d8e3
Merge branch 'main' of github.com:cardstack/boxel
IanCal 79409bc
Merge branch 'main' into cs-9552-refactor-realm-event-sending-to-use-…
IanCal 1afb5ae
Fix syntax
IanCal 5cb89d1
node test realm is the owner
IanCal 801d6d1
fix syntax error
IanCal eea7e1f
syntax error
IanCal b3473df
JWTs need to have matching permissions, add test realm user as owner
IanCal f501fe0
Remove extra user, remove unnecessary filesystem content
IanCal 86664a9
No longer creating a session room for creating a realm
IanCal f966aab
Linting and type fixes
IanCal a94a476
Improve where we get userId to not require login
IanCal c467c04
Use test realm info for id
IanCal a495154
Import fix
IanCal fb458c4
Restore import as it was earlier
IanCal a231047
Index events contain realm url
IanCal 1974d26
Realm server is realm user
IanCal 6a5402e
Lint
IanCal 5ff6b80
Move the session room to the users table now that it is 1:1
IanCal 5ada8be
Restore realm bot user for published realms
IanCal d676caa
Require realm urls in events, add new ones for file watching
IanCal ce8f3d3
Event test updates
IanCal 1a4c9dc
Update session room work in tests
IanCal 9c7ef14
Require that sessions are only created for users that exist and that …
IanCal ed163c7
Update schema
IanCal 1fc0b8c
Can't have too many 0s in your migration filename
IanCal f0ed61b
Don't login without the user existing
IanCal 822c36c
Make sure users exist at the correct points in tests
IanCal 5418d39
Add user in CLI tests
IanCal c088fa7
Specify username
IanCal 18a8d61
Linting
IanCal abfe929
Only create dm rooms for users that exist in the table already
IanCal 289cf14
Linting
IanCal 9086d4f
Only create session rooms when users exist for now
IanCal 5b3d296
Don't remove the sessions table
IanCal daa217a
Delete packages/postgres/migrations/1770648743000_add-realm-user-id-t…
IanCal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
File renamed without changes.
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
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
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
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
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
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
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
19 changes: 19 additions & 0 deletions
19
packages/postgres/migrations/1771264925000_move-session-room-to-users.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| exports.up = (pgm) => { | ||
| pgm.addColumns('users', { | ||
| session_room_id: { type: 'varchar' }, | ||
| }); | ||
|
|
||
| pgm.sql(` | ||
| UPDATE users | ||
| SET session_room_id = sr.room_id | ||
| FROM session_rooms sr | ||
| WHERE users.matrix_user_id = sr.matrix_user_id | ||
| AND sr.realm_url = '__realm-server__' | ||
| `); | ||
|
|
||
| pgm.dropTable('session_rooms'); | ||
| }; | ||
|
|
||
| exports.down = (pgm) => { | ||
| pgm.dropColumns('users', ['session_room_id']); | ||
| }; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
processDecryptedEventFromAuthRoomnow relays anyAPP_BOXEL_REALM_EVENT_TYPEevent as long ascontent.realmURLexists, but this path is reached for every non-AI room event. That means a participant in any unrelated DM/group room can send a crafted realm event and trigger invalidations for whatever realm URL the client is subscribed to. Previously this code first resolvedevent.room_idto a known session room before relaying, so removing that check introduces spoofable cross-room realm updates.Useful? React with 👍 / 👎.