feat: Implement event rejection #1747
No reviewers
Labels
No labels
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
Wont fix
old/ci/cd
old/rust
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity!1747
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "nex/feat/rejected-events"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements event rejection (see: part 3.3 of https://spec.matrix.org/v1.18/rooms/v12/#authorization-rules), which should help resolve some netsplits observed in the continuwuity rooms.
Also un-flags PDUs as soft-failed or rejected when forcing our local state (e.g. when joining via a remote server, or force setting the state, in turn giving us a "clean" slate), and added the
!admin users force-join-room-remotelyadmin command to support forcing a remote join, which may work around local-only issues.Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
@ -124,0 +141,4 @@}/// Removes any soft-fail or rejection markers applied to the target PDUpub(super) fn unmark_pdu(&self, event_id: &EventId) {suggested name:
clear_pdu_markers@ -143,0 +163,4 @@&& !self.db.is_event_soft_failed(event_id).await}pub fn unmark_pdu(&self, event_id: &EventId) { self.db.unmark_pdu(event_id); }same here
!admin debug get-pdumore informative d95bf66e3d!admin debug show-auth-chainunmark_pdutoclear_pdu_markers@ -48,0 +57,4 @@}// If any of the auth events are rejected, this event is also rejected.for aid in incoming_pdu.auth_events() {This check should be moved into
handle_incoming_pdub884fbd2408d26dcd7a3@ -70,2 +70,4 @@}#[derive(Clone, Copy, Eq, PartialEq)]enum NodeStatus {suggestion:
tried this and it was balls
@ -72,0 +107,4 @@match status {| NodeStatus::Rejected(_) => writeln!(graph, "class {node_id} rejected;")?,| NodeStatus::SoftFailed(_) => writeln!(graph, "class {node_id} soft_failed;")?,| NodeStatus::Normal(_) => {},would be nice if the target event had special styling to make it more obvious in a large graph
I did experiment with a few formats but I couldn't really find anything that remained legible. Maybe
eventID (eventType), buteventID (eventType, stateKey)and permutations were all too much@ -72,0 +141,4 @@return Err!("Event not found.");};let mut graph = String::from(perhaps use Askama to build this string?
seems unnecessary
@ -218,0 +220,4 @@.write().insert(room_id.into(), (event_id.to_owned(), start_time));defer! {{space after macro invocation 🤨 what does this macro do anyway
idk i copied this from another place :D
defer... defers the call to the end of the function, even if the function returns early. It's like a
finallybranch of a try/except, it always executes when the function finishes@ -48,0 +59,4 @@// If any of the auth events are rejected, this event is also rejected.for aid in incoming_pdu.auth_events() {if self.services.pdu_metadata.is_event_rejected(aid).await {// TODO: debug_warn instead of warn⚠️todo alert
@ -147,0 +178,4 @@if !auth_check {warn!(event_id = %incoming_pdu.event_id,"Event authentication fails based on the current state of the room"s/authentication/authorization. also this should probably be a debug_warn
idk our soft-fail log isn't
@ -294,6 +296,7 @@ impl Service {servers: &[OwnedServerName],state_lock: RoomMutexGuard,) -> Result {// public so the admin command force-join-room-remotely workswe should probably just have one admin command that does local and remote force joins
8d26dcd7a357c5aab18757c5aab187dd6d61fd2a42d6077397512a96f832