mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-06 15:38:25 +00:00
fix: reduce log noise for expected state event rejections during sync
State events from remote relays for repos we don't host are expected rejections during proactive sync. Changed to only WARN for user-submitted events (potential misconfiguration/attack) while using DEBUG for synced events (normal operation). This reduces log noise from ~1967 warnings to <10 warnings in a 30-second production sync test, making real issues visible again.
This commit is contained in:
+32
-13
@@ -81,12 +81,21 @@ impl StatePolicy {
|
||||
// CRITICAL: Check if author is authorized via maintainer set
|
||||
// State events MUST be rejected if author is not in maintainer set of any accepted announcement
|
||||
if db_repo_data.announcements.is_empty() {
|
||||
tracing::warn!(
|
||||
event_id = %event.id,
|
||||
identifier = %state.identifier,
|
||||
author = %event.pubkey.to_hex(),
|
||||
"Rejecting state event: no announcement exists for this repository"
|
||||
);
|
||||
if is_synced {
|
||||
tracing::debug!(
|
||||
event_id = %event.id,
|
||||
identifier = %state.identifier,
|
||||
author = %event.pubkey.to_hex(),
|
||||
"Rejecting state event: no announcement exists for this repository"
|
||||
);
|
||||
} else {
|
||||
tracing::warn!(
|
||||
event_id = %event.id,
|
||||
identifier = %state.identifier,
|
||||
author = %event.pubkey.to_hex(),
|
||||
"Rejecting state event: no announcement exists for this repository"
|
||||
);
|
||||
}
|
||||
return Ok(WritePolicyResult::Reject {
|
||||
status: false,
|
||||
message: "invalid: no announcement exists for this repository".into(),
|
||||
@@ -99,13 +108,23 @@ impl StatePolicy {
|
||||
);
|
||||
|
||||
if authorized_owners.is_empty() {
|
||||
tracing::warn!(
|
||||
event_id = %event.id,
|
||||
identifier = %state.identifier,
|
||||
author = %event.pubkey.to_hex(),
|
||||
announcements_count = db_repo_data.announcements.len(),
|
||||
"Rejecting state event: author not in maintainer set of any announcement"
|
||||
);
|
||||
if is_synced {
|
||||
tracing::debug!(
|
||||
event_id = %event.id,
|
||||
identifier = %state.identifier,
|
||||
author = %event.pubkey.to_hex(),
|
||||
announcements_count = db_repo_data.announcements.len(),
|
||||
"Rejecting state event: author not in maintainer set of any announcement"
|
||||
);
|
||||
} else {
|
||||
tracing::warn!(
|
||||
event_id = %event.id,
|
||||
identifier = %state.identifier,
|
||||
author = %event.pubkey.to_hex(),
|
||||
announcements_count = db_repo_data.announcements.len(),
|
||||
"Rejecting state event: author not in maintainer set of any announcement"
|
||||
);
|
||||
}
|
||||
return Ok(WritePolicyResult::Reject {
|
||||
status: false,
|
||||
message: "invalid: author not authorized for this repository".into(),
|
||||
|
||||
Reference in New Issue
Block a user