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

exp/services/recoverysigner: empty allowed accounts cause application crash #3665

Closed
leighmcculloch opened this issue Jun 4, 2021 · 2 comments
Labels

Comments

@leighmcculloch
Copy link
Member

When starting the recoverysigner without allowed accounts, the application crashes.

The allowed accounts feature added in 15de5ff is intended to be an optional feature, but it appears it is required by the code because the code isn't handling its absence. The CLI options parameters don't have the parameter defined as required, so there is no helpful error message if a user doesn't provide it.

When starting the application without the parameter specified, I see the following error as if I have provided a malformed invalid value for the option.

FATA[2021-06-04T21:59:55.747Z] Error: parsing allowed source accounts: strkey is 0 bytes long; minimum valid length is 5  pid=17606

I think this should be fixed by keeping the parameter as optional and making it so that if no value is provided the previous behavior is retained.

@leighmcculloch
Copy link
Member Author

I think the bug exists in the following code. strings.Split always returns at least one value, which will be an empty string if an empty string was given to the function.

allowedSourceAccounts := []*keypair.FromAddress{}
for _, addressStr := range strings.Split(opts.AllowedSourceAccounts, ",") {
accountAddress, err := keypair.ParseAddress(addressStr)
if err != nil {
return handlerDeps{}, errors.Wrap(err, "parsing allowed source accounts")
}
allowedSourceAccounts = append(allowedSourceAccounts, accountAddress)
}

@mollykarcher
Copy link
Contributor

Closing all recoverysigner issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants