feat(session): Validate MLS Add Proposals Against Known Users#21
Merged
Conversation
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.
Overview
This Pull Request introduces a critical security enhancement to the MLS session management by implementing validation for "add" proposals. Previously, any well-formed "add" proposal would be processed by the MLS client. With this change, the system now verifies that any user proposed for addition to an MLS group is a pre-approved, known user within the session's context.
Key Changes
processProposalBatchLockedfunction insession/mls.goto include a new validation step. Before processing anAddproposal, the system now extracts theUserIDfrom the proposal'sKeyPackage.UserIDis then checked against the session's internal list of known users (s.users). If theUserIDis not found in this list, theAddproposal is explicitly ignored, preventing unauthorized additions.addProposalUserID, was introduced to safely extract theUserIDfrom anAddproposal. This function includes robust error handling for cases where the identity bytes cannot be parsed into aUserID(e.g., malformed credentials), ensuring such proposals are rejected.processProposalBatchLockedfunction now returns a boolean indicating whether any append proposals were successfully accepted. This allowsprocessAndCommitProposalBatchLockedto skip the commit phase if no valid append proposals were processed, optimizing group state updates.session/proposal_validation_test.go, which includes dedicated unit tests to verify the new validation logic. These tests cover scenarios for ignoring unexpected adds, accepting expected adds, and rejecting adds with unparseable identities.mls-godependency tov1.5.0ingo.modandexamples/voice/go.mod.Technical Impact
Addproposals, the system becomes more resilient to malformed or unauthorized proposals, reducing the risk of unexpected group state changes or potential attack vectors.addProposalUserIDhelper centralizes the logic for extracting user IDs from add proposals, improving code clarity and maintainability.🧪 Test Plan & Evidence
Suggested Manual Verification
go test ./...and ensure all tests pass