fix: Don't panic when receiving PDUs with illegal auth events

Apparently some servers do this??
This commit is contained in:
timedout committed 2026-08-18 17:50:18 +01:00
1 parent 1cdf369a80
commit 7b3e3a26bb
2 files changed
+8 -7

No files matched your search

@@ -170,12 +170,13 @@ impl super::Service {
.expect("we just checked that we have all auth events") .expect("we just checked that we have all auth events")
.to_owned(); .to_owned();
let key = auth_event.kind().with_state_key( let Some(state_key) = auth_event.state_key() else {
auth_event self.reject_and_persist(event_id, &incoming_pdu);
.state_key return Err!(Request(Forbidden(debug_warn!(
.clone() "Event references non-state event as an auth event: {id}",
.expect("all auth events must have state keys"), ))));
); };
let key = auth_event.kind().with_state_key(state_key);
match auth_events_by_key.entry(key) { match auth_events_by_key.entry(key) {
| hash_map::Entry::Vacant(v) => { | hash_map::Entry::Vacant(v) => {
v.insert(auth_event); v.insert(auth_event);
+1 -1
View File
@@ -7,7 +7,7 @@ use axum::{
routing::{get, on}, routing::{get, on},
}; };
use conduwuit_api::client_ip::ClientIp; use conduwuit_api::client_ip::ClientIp;
use conduwuit_core::{config::TermsDocument, info, warn}; use conduwuit_core::{config::TermsDocument, warn};
use conduwuit_service::{ use conduwuit_service::{
mailer::messages, mailer::messages,
registration_tokens::ValidToken, registration_tokens::ValidToken,