security: sign UserProfile broadcasts (#145)#155
Merged
Conversation
UserProfile broadcasts were wrapped in a plain Envelope with no signature, so any peer could broadcast a profile claiming any peer_id and spoof that peer's display name in the UI. Replace the unsigned envelope with an Ed25519-signed pack/unpack pair dedicated to profiles: `willow_identity::pack_profile` signs the profile, and `unpack_profile` verifies the signature AND that the signer matches the claimed `profile.peer_id`. Mismatches return a new typed `IdentityError::PeerMismatch` and are logged at `warn!` on the receive path. The wire format changes (envelope -> signed envelope); no deployed consumer depends on the old format. Closes #145 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
UserProfilebroadcasts were wrapped in a plainEnvelopewith no signature, so any peer could broadcast a profile claiming anypeer_idand spoof that peer's display name.willow_identity::pack_profile/unpack_profilehelpers that Ed25519-sign the profile and reject it on receive unless the verified signer equalsprofile.peer_id.IdentityError::PeerMismatch { claimed, signer }; mismatches are rejected and logged atwarn!in the listener.connect.rsNeighborUp retry +broadcast_profile_via_network) and the receive path inlisteners.rs.Threat addressed
Display-name spoofing on the
_willow_profilestopic. Any peer could publish a signed-looking envelope with another peer'speer_idand an arbitrarydisplay_name, which the client would blindly store and render. With this change the receive path drops any profile whose verified Ed25519 signer does not match the claimedpeer_id.Test plan
cargo fmt --checkcargo clippy -p willow-identity --all-targets -- -D warningscargo clippy -p willow-client --all-targets -- -D warningscargo test -p willow-identity— 26 passed, including newpack_and_unpack_profile_accepts_self_signed,unpack_profile_rejects_spoofed_peer_id,unpack_profile_rejects_tampered_bytescargo test -p willow-client— 74 passedcargo check --target wasm32-unknown-unknown -p willow-clientCloses #145