Feat/nmv3 agents subscription#6567
Conversation
0d448ec to
8b74347
Compare
46a5856 to
add8d89
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
add8d89 to
964df4e
Compare
8b74347 to
a6b7062
Compare
a6b7062 to
81dbb72
Compare
964df4e to
916213f
Compare
81dbb72 to
f2b6a97
Compare
916213f to
461075f
Compare
| } | ||
|
|
||
| fn swap(&self, new: HashSet<IpAddr>) { | ||
| self.inner.known.store(Arc::new(new)) |
There was a problem hiding this comment.
That's not a compare and swap, if by any chance two threads arrive at the same time, the first update will be lost
There was a problem hiding this comment.
which is not a problem because there is only ever one thread performing writes to the list of known addresses. the arcswap exists here for the purposes of lock-free reads and eventual consistency
There was a problem hiding this comment.
Can we then update the comment about it being thread-safe?
| .iter() | ||
| .all(|p| allowed.contains(p) || denied.contains(p)) | ||
| { | ||
| return; |
There was a problem hiding this comment.
If the pending addresses are already resolve, we might want to clear them no?
| // NO → Process normally (finalise_unwrapping) | ||
| // YES → Go to step 2 | ||
| // | ||
| // 2. Is source IP an authorised network monitor? |
There was a problem hiding this comment.
This might not be enough, IP addresses can be spoofed
| /// | ||
| /// # Thread Safety | ||
| /// | ||
| /// Safe to use across threads - updates to `network_monitors` use lock-free ArcSwap internally. |
There was a problem hiding this comment.
Actually not, as the update is not a compare and swap. Badly timed updates will overwrite each other. See comment in network_filter.rs
There was a problem hiding this comment.
as I mentioned there's only a single writer thread, so it's fine. the module wasn't designed with multiple writers in mind
461075f to
c01b728
Compare
…list of NM agents
c01b728 to
617acd4
Compare
NR-759
Nym node chain watcher and network monitors agents bypass
Summary
This PR introduces real-time blockchain monitoring for network monitor agent authorizations and implements replay protection bypass for authorized network monitor (NM) agents. This allows NM agents to perform node stress testing, while maintaining security for regular traffic.
Key Changes
1. Real-Time Blockchain Subscription for Network Monitor Agents
New Module:
nym-node/src/node/nyxd_watcher/network_monitor_agents.rsMsgModuletrait to watch for Network Monitors smart contract messagesAuthoriseNetworkMonitor,RevokeNetworkMonitor, orRevokeAllNetworkMonitorsmessages are executed on-chainIntegration: Websocket subscription to nyx blockchain using the enhanced
nyxd-scraperframework2. Replay Protection Bypass for Authorized Network Monitors
nym-node/src/node/mixnet/handler.rsis_from_authorised_network_monitor_agent()3. Enhanced Prometheus Metrics
ingress_replayed_packet()- Now properly tracked when replay detection triggersingress_network_monitor_packet()- Counts packets from authorized NM agentsTechnical Details
Packet Journey for Replay Protection
Authorization Flow
Testing Considerations
Breaking Changes
None - fully backward compatible with existing configurations.
Security Implications
ingress_network_monitor_packetmetric for unexpected activityRelated Issues
This change is