fix(cli): add robust input validation for Ethereum address identifiers#1814
Open
sethoshi18 wants to merge 2 commits into
Open
fix(cli): add robust input validation for Ethereum address identifiers#1814sethoshi18 wants to merge 2 commits into
sethoshi18 wants to merge 2 commits into
Conversation
Add `validateIdentifier` utility in the CLI using viem's `isAddress` to ensure Ethereum addresses are structurally sound before passing them to the SDK. This prevents the CLI from making unnecessary network calls or encountering confusing downstream C++ binding errors when given malformed input. Applied validation symmetrically across the following commands: - `client change-recovery-identifier` - `client inbox-id` - `client remove-account` - `conversation add-members` - `conversation remove-members` - `conversations create-dm` - `conversations create-group` Includes an offline unit test for `create-dm` to verify the fast-failure path.
|
Add `validateIdentifier` utility in the CLI using viem's `isAddress` to ensure Ethereum addresses are structurally sound before passing them to the SDK. This prevents the CLI from making unnecessary network calls or encountering confusing downstream C++ binding errors when given malformed input. Applied validation symmetrically across the following commands: - `client change-recovery-identifier` - `client inbox-id` - `client remove-account` - `conversation add-members` - `conversation remove-members` - `conversations create-dm` - `conversations create-group` Includes an offline unit test for `create-dm` to verify the fast-failure path.
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.
Add
validateIdentifierutility in the CLI using viem'sisAddressto ensure Ethereum addresses are structurally sound before passing them to the SDK. This prevents the CLI from making unnecessary network calls or encountering confusing downstream C++ binding errors when given malformed input.Applied validation symmetrically across the following commands:
client change-recovery-identifierclient inbox-idclient remove-accountconversation add-membersconversation remove-membersconversations create-dmconversations create-groupIncludes an offline unit test for
create-dmto verify the fast-failure path.Note
Add Ethereum address validation to CLI commands before execution
validateIdentifierutility inutils/client.tsthat usesviem'sisAddressto throw on invalid Ethereum addresses.change-recovery-identifier,inbox-id,remove-account,add-members,remove-members,create-dm,create-group) so invalid addresses are rejected before any network call or confirmation prompt.create-dmsuite asserting the command fails with an'Invalid Ethereum address'message.Macroscope summarized 823b8f3.