Gate identity learning on signature in NodeDB::updateUser - #11084
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthrough
ChangesSigner-aware identity updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant NodeInfoModule
participant TrafficManagementModule
participant NodeDB
NodeInfoModule->>NodeDB: Pass NodeInfo identity and xeddsa_signed
TrafficManagementModule->>NodeDB: Pass direct-response identity and xeddsa_signed
NodeDB->>NodeDB: Allow or reject identity update based on signer state
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
NodeInfoModule gated its unsigned-signer check on isBroadcast, so the unicast path reached updateUser without the same scrutiny. The public-key comparison in updateUser is not sufficient on its own here. Same shape as the case already handled in TrafficManagementModule, applied to the primary NodeInfo path. updateUser now takes xeddsaSigned and skips the identity write when the stored node has the signer bit and the update is unsigned. The packet is still accepted, so unicast signer exchanges keep working. Defaults to false so callers fail closed. Self-updates are exempt. Tests: C5 unsigned unicast from a signer does not change the stored name, C6 the signed case still does, C7 non-signers are unaffected.
375e1fc to
20c5706
Compare
⚡ Try this PR in the Web FlasherNote Building this pull request… the flash button, badges and supported-board |
Problem
NodeInfoModulegated its unsigned-signer check onisBroadcast(mp.to), so the unicast path reachednodeDB->updateUserwithout the same scrutiny. The public-key comparison inupdateUseris not sufficient on its own here.Same shape as the case already handled in
TrafficManagementModule, applied to the primary NodeInfo path.Fix
Gated inside
NodeDB::updateUser, the single chokepoint for identity learning. It takes a newxeddsaSignedparameter and skips the identity write when the stored node has the signer bit and the update is unsigned:Notes on the design:
false, so any unaudited or future caller fails closed.nodeId != getNodeNum(), which keepsMeshService::reloadOwnerworking unchanged.infobeforeCopyUserToNodeInfoLiteoverwrites it, so it tests the stored signer bit rather than the incoming one.Callers now pass
mp.xeddsa_signed. The existingunauthenticatedSignerguard inTrafficManagementModuleis now redundant (its path is only reached for non-signers) but was left in place.Tests
Added to
test_packet_signinggroup C:test_packet_signing34/34, plustest_fuzz_packets,test_traffic_management,test_nodedb_blocked,test_type_conversions93/93 onnative-windows.Summary by CodeRabbit
Bug Fixes
Tests