Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multipath RegEx #4

Merged
merged 4 commits into from
Feb 24, 2021
Merged

Fix multipath RegEx #4

merged 4 commits into from
Feb 24, 2021

Conversation

rekmarks
Copy link
Member

@rekmarks rekmarks commented Feb 23, 2021

This updates the multipath validation to allow for a broader range of sub-paths, and adds unit tests for the input validation. Paths starting with bip32 segments will still require a parentKey to be specified, and paths starting with bip39 will still require that no parentKey is specified. Paths longer than 5 bip32 segments will not be accepted, because BIP-44 only defines paths of length 5, excluding the seed.

Specifically, we change the quantifier for intermediate bip32 path segments of the multipath RegEx from {3,4} to {0,4}. In conjunction with the other RegEx validators, this means that the following multipaths will now be accepted:

bip32:44'/bip32:60'/bip32:0'/bip32:0/bip32:0
bip32:44'/bip32:60'/bip32:0'/bip32:0
bip32:44'/bip32:60'/bip32:0'
bip32:44'/bip32:60'
bip32:44'

bip39:a b c d e f g h i j k l/bip32:44'/bip32:60'/bip32:0'/bip32:0/bip32:0
bip39:a b c d e f g h i j k l/bip32:44'/bip32:60'/bip32:0'/bip32:0
bip39:a b c d e f g h i j k l/bip32:44'/bip32:60'/bip32:0'
bip39:a b c d e f g h i j k l/bip32:44'/bip32:60'
bip39:a b c d e f g h i j k l/bip32:44'
bip39:a b c d e f g h i j k l

Prior to this PR, only the following multipaths were accepted:

bip32:44'/bip32:60'/bip32:0'/bip32:0/bip32:0
bip32:44'/bip32:60'/bip32:0'/bip32:0
bip32:44'

bip39:a b c d e f g h i j k l/bip32:44'/bip32:60'/bip32:0'/bip32:0/bip32:0
bip39:a b c d e f g h i j k l/bip32:44'/bip32:60'/bip32:0'/bip32:0
bip39:a b c d e f g h i j k l

@rekmarks rekmarks requested a review from kumavis February 23, 2021 17:38
Base automatically changed from master to main February 23, 2021 17:52
@rekmarks rekmarks requested a review from a team as a code owner February 23, 2021 17:52
@rekmarks rekmarks force-pushed the fix-multi-path-regex branch from fd84d69 to 02dba7b Compare February 23, 2021 18:26
@kumavis kumavis merged commit 4695e51 into main Feb 24, 2021
@kumavis kumavis deleted the fix-multi-path-regex branch February 24, 2021 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants