mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 13:16:56 +00:00
fix: Don't panic when receiving PDUs with illegal auth events
Apparently some servers do this??
This commit is contained in:
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);
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in new issue
Block a user