Implement BLE MAC Address Randomization - #1
Merged
Conversation
Remove trailing blank line at end of ble_transport.rs and trailing whitespace on an empty doc-comment line in unified.rs. Both are normalized by `cargo fmt --check`, which was failing the CI step.
Sort the ble_transport import group in unified.rs and wrap two over-length send_with_timeout calls in the gossip integration test, matching cargo fmt output. The test-file lines were pre-existing formatting violations on main.
- Avoid use-after-move of ble_peers in notify_mac_rotated by iterating over a reference so the subsequent len() read stays valid. - Drop unused mut bindings in two BleCentral rotation tests. These were masked by the earlier formatting failure and surface once cargo clippy --all-targets --all-features -- -D warnings runs.
The 'outer loop only ever exits via `break 'outer`, so it never iterates a second time, tripping clippy::never_loop (deny-by-default). Convert it to a labeled block, preserving the advertise-once-then-accept behavior and the two `break 'outer` exit paths.
Implement BLE MAC address randomization for privacy
Fix: Remove Incorrect soroban-sdk Dependency from Core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements MAC address randomization for the simulated BLE Central to close the
passive-tracking privacy gap: a static device address let an observer correlate a
device across Bluetooth scans over time. This defines the rotation interface and
policy so both the simulation and a future Android JNI binding implement the same
contract.
Changes
MacAddressProvidertrait +RandomMacProvider(ble_transport.rs):injectable MAC generation.
RandomMacProvider::generate()produces a 6-byteaddress with the locally-administered bit set and the multicast bit cleared.
BleCentralrotation state (ble_transport.rs): addscurrent_mac,mac_provider,last_rotation, androtation_interval(default 15 minutes),plus
rotate_mac_if_due(), which rotates only once per elapsed interval andreturns
Some(new_mac)on rotation,Noneotherwise.TopologyFlag::MacRotated(types.rs): variant is now defined and emitted.TransportManager(unified.rs):power_tick_at()callsrotate_mac_if_due()and, on rotation, appendsTopologyFlag::MacRotatedtoPowerTickOutcome::topology_flagsso the gossip loop can broadcast the new MAC.notify_mac_rotated()(unified.rs): drops all BLE connections (theyreference the stale MAC) while leaving WiFi-Direct connections intact, and keeps
peer_countconsistent.Testing
RandomMacProvider::generate()sets the locally-administered bit and clears themulticast bit over 1000 samples.
rotate_mac_if_due()returnsNonebefore the interval andSome(_)after;a second immediate call returns
None(no double rotation).TopologyFlag::MacRotatedis present inpower_tickoutput on the rotation roundand absent before the interval elapses.
notify_mac_rotated; WiFi-Direct survives.transport::ble_transporttests pass.Closes StellarConduit#38