Compare commits

..

8 commits

Author SHA1 Message Date
nexy7574
5ebe8cd8dd
feat(policy-server): Limit policy server request timeout to 10 seconds
Some checks failed
Checks / Prefligit / prefligit (push) Failing after 7s
Release Docker Image / define-variables (push) Failing after 18s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Checks / Rust / Format (push) Failing after 6s
Checks / Rust / Clippy (push) Failing after 20s
Checks / Rust / Cargo Test (push) Failing after 15s
2025-07-19 22:07:18 +01:00
nexy7574
d4049a79bf
feat(policy-server): Prevent local events that fail the policy check
Some checks failed
Checks / Prefligit / prefligit (push) Failing after 1s
Release Docker Image / define-variables (push) Failing after 1s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Checks / Rust / Format (push) Failing after 1s
Checks / Rust / Clippy (push) Failing after 12s
Checks / Rust / Cargo Test (push) Failing after 15s
2025-07-19 21:09:23 +01:00
nexy7574
1bc06fcd57
feat(policy-server): Soft-fail redactions for failed events 2025-07-19 20:54:06 +01:00
nexy7574
cff4076fad
style(policy-server): Restructure logging 2025-07-19 20:50:47 +01:00
nexy7574
dded3a2981
fix(policy-server): Avoid unnecessary database lookup 2025-07-19 20:47:02 +01:00
nexy7574
ca263af321
chore: Update ruwuma & fix lints
Some checks failed
Checks / Prefligit / prefligit (push) Failing after 3s
Release Docker Image / define-variables (push) Failing after 1s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Checks / Rust / Format (push) Failing after 6s
Checks / Rust / Clippy (push) Failing after 22s
Checks / Rust / Cargo Test (push) Failing after 12s
2025-07-19 20:34:34 +01:00
nexy7574
19a8eaca39
chore: Merge branch 'main' into nex/serving-policy
# Conflicts:
#	src/service/rooms/event_handler/upgrade_outlier_pdu.rs
#	src/service/rooms/timeline/mod.rs
2025-07-19 20:26:08 +01:00
nexy7574
ce94e241b3
feat(policy-server): Policy server following 2025-07-19 20:22:29 +01:00
4 changed files with 2 additions and 30 deletions

View file

@ -1,19 +1,5 @@
[files]
extend-exclude = ["*.csr", "*.lock", "pnpm-lock.yaml"]
[default]
extend-ignore-re = [
"(?Rm)^.*(#|//|<!--)\\s*spellchecker:disable-line(\\s*-->)$", # Ignore a line by making it trail with a `spellchecker:disable-line` comment
"^[0-9a-f]{7,}$", # Commit hashes
# some heuristics for base64 strings
"[A-Za-z0-9+=]{72,}",
"([A-Za-z0-9+=]|\\\\\\s\\*){72,}",
"[0-9+][A-Za-z0-9+]{30,}[a-z0-9+]",
"\\$[A-Z0-9+][A-Za-z0-9+]{6,}[a-z0-9+]",
"\\b[a-z0-9+/=][A-Za-z0-9+/=]{7,}[a-z0-9+/=][A-Z]\\b",
]
extend-exclude = ["*.csr"]
[default.extend-words]
"allocatedp" = "allocatedp"

View file

@ -11,10 +11,6 @@ use ruma::{
#[implement(super::Service)]
#[tracing::instrument(skip_all, level = "debug")]
pub async fn policyserv_check(&self, pdu: &PduEvent, room_id: &RoomId) -> Result {
if *pdu.event_type() == StateEventType::RoomPolicy.into() {
debug!("Skipping spam check for policy server meta-event in room {room_id}");
return Ok(());
}
let Ok(policyserver) = self
.services
.state_accessor
@ -32,14 +28,6 @@ pub async fn policyserv_check(&self, pdu: &PduEvent, room_id: &RoomId) -> Result
return Ok(());
},
};
if via.is_empty() {
debug!("Policy server is empty for room {room_id}, skipping spam check");
return Ok(());
}
if !self.services.state_cache.server_in_room(via, room_id).await {
debug!("Policy server {via} is not in the room {room_id}, skipping spam check");
return Ok(());
}
let outgoing = self
.services
.sending

View file

@ -43,7 +43,6 @@ struct Services {
server_keys: Dep<server_keys::Service>,
short: Dep<rooms::short::Service>,
state: Dep<rooms::state::Service>,
state_cache: Dep<rooms::state_cache::Service>,
state_accessor: Dep<rooms::state_accessor::Service>,
state_compressor: Dep<rooms::state_compressor::Service>,
timeline: Dep<rooms::timeline::Service>,
@ -69,7 +68,6 @@ impl crate::Service for Service {
pdu_metadata: args.depend::<rooms::pdu_metadata::Service>("rooms::pdu_metadata"),
short: args.depend::<rooms::short::Service>("rooms::short"),
state: args.depend::<rooms::state::Service>("rooms::state"),
state_cache: args.depend::<rooms::state_cache::Service>("rooms::state_cache"),
state_accessor: args
.depend::<rooms::state_accessor::Service>("rooms::state_accessor"),
state_compressor: args

View file

@ -55,7 +55,7 @@ where
// backwards extremities doing all the checks in this list starting at 1.
// These are not timeline events.
debug!("Resolving state at event {}", incoming_pdu.event_id);
debug!("Resolving state at event");
let mut state_at_incoming_event = if incoming_pdu.prev_events().count() == 1 {
self.state_at_incoming_degree_one(&incoming_pdu).await?
} else {