unstoppabledomains/resolution-go

Zcash Sapling Address regexp pattern is incorrect

boyfromcave opened this issue · 1 comments

"validationRegex": "^z([a-zA-Z0-9]){94}$|^zs([a-zA-Z0-9]){75}$|^t([a-zA-Z0-9]){34}$"

Zcash Sapling addresses are 78 characters in length.

This middle regexp pattern will be shy by 1 character. only 77 characters.
I have tested this in your UD interface for adding a sapling address to a crypto domain; if a user adds a valid sapling address, the UI errors and says it is invalid address. But if you delete 1 character from a valid address, then your UD interface accepts the sapling address as valid.

The error is a bug. It appears that the regexp is missing the "1" in the middle pattern, "zs1". Adding the 1 in the pattern will extend the length of the address to 78 characters, which is correct.

So, the corrected regexp should be: "^z([a-zA-Z0-9]){94}$|^zs1([a-zA-Z0-9]){75}$|^t([a-zA-Z0-9]){34}$"

Note: this bug was found by a Ycash contributor. We review Zcash and Ycash related code, as we feel both should be widely supported.

@boyfromcave Thanks for reporting this issue. It should be fixed with our latest version v2.1.0.