diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-10 00:29:46 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-10 00:29:46 +0000 |
| commit | a84ae9f2a241a9ab5239ffad23537d3c0be1ccfc (patch) | |
| tree | eacae4740c68a3914ef65787eeb8a08190373aed /src | |
| parent | ced6ef15a1e2ff4babd8a291f6d423846d986302 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nostr/policy/state.rs | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/src/nostr/policy/state.rs b/src/nostr/policy/state.rs index b850e7b..f94f004 100644 --- a/src/nostr/policy/state.rs +++ b/src/nostr/policy/state.rs | |||
| @@ -81,12 +81,21 @@ impl StatePolicy { | |||
| 81 | // CRITICAL: Check if author is authorized via maintainer set | 81 | // CRITICAL: Check if author is authorized via maintainer set |
| 82 | // State events MUST be rejected if author is not in maintainer set of any accepted announcement | 82 | // State events MUST be rejected if author is not in maintainer set of any accepted announcement |
| 83 | if db_repo_data.announcements.is_empty() { | 83 | if db_repo_data.announcements.is_empty() { |
| 84 | tracing::warn!( | 84 | if is_synced { |
| 85 | event_id = %event.id, | 85 | tracing::debug!( |
| 86 | identifier = %state.identifier, | 86 | event_id = %event.id, |
| 87 | author = %event.pubkey.to_hex(), | 87 | identifier = %state.identifier, |
| 88 | "Rejecting state event: no announcement exists for this repository" | 88 | author = %event.pubkey.to_hex(), |
| 89 | ); | 89 | "Rejecting state event: no announcement exists for this repository" |
| 90 | ); | ||
| 91 | } else { | ||
| 92 | tracing::warn!( | ||
| 93 | event_id = %event.id, | ||
| 94 | identifier = %state.identifier, | ||
| 95 | author = %event.pubkey.to_hex(), | ||
| 96 | "Rejecting state event: no announcement exists for this repository" | ||
| 97 | ); | ||
| 98 | } | ||
| 90 | return Ok(WritePolicyResult::Reject { | 99 | return Ok(WritePolicyResult::Reject { |
| 91 | status: false, | 100 | status: false, |
| 92 | message: "invalid: no announcement exists for this repository".into(), | 101 | message: "invalid: no announcement exists for this repository".into(), |
| @@ -99,13 +108,23 @@ impl StatePolicy { | |||
| 99 | ); | 108 | ); |
| 100 | 109 | ||
| 101 | if authorized_owners.is_empty() { | 110 | if authorized_owners.is_empty() { |
| 102 | tracing::warn!( | 111 | if is_synced { |
| 103 | event_id = %event.id, | 112 | tracing::debug!( |
| 104 | identifier = %state.identifier, | 113 | event_id = %event.id, |
| 105 | author = %event.pubkey.to_hex(), | 114 | identifier = %state.identifier, |
| 106 | announcements_count = db_repo_data.announcements.len(), | 115 | author = %event.pubkey.to_hex(), |
| 107 | "Rejecting state event: author not in maintainer set of any announcement" | 116 | announcements_count = db_repo_data.announcements.len(), |
| 108 | ); | 117 | "Rejecting state event: author not in maintainer set of any announcement" |
| 118 | ); | ||
| 119 | } else { | ||
| 120 | tracing::warn!( | ||
| 121 | event_id = %event.id, | ||
| 122 | identifier = %state.identifier, | ||
| 123 | author = %event.pubkey.to_hex(), | ||
| 124 | announcements_count = db_repo_data.announcements.len(), | ||
| 125 | "Rejecting state event: author not in maintainer set of any announcement" | ||
| 126 | ); | ||
| 127 | } | ||
| 109 | return Ok(WritePolicyResult::Reject { | 128 | return Ok(WritePolicyResult::Reject { |
| 110 | status: false, | 129 | status: false, |
| 111 | message: "invalid: author not authorized for this repository".into(), | 130 | message: "invalid: author not authorized for this repository".into(), |