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

Validate ignored peers and BTC nodes #3895

Merged
merged 6 commits into from
Jan 14, 2020

Conversation

devinbileck
Copy link
Member

In addition to adding input validation for ignored peers and BTC nodes, this PR also fixes #3137.

Since with input validation the user is no longer able to enter an invalid BTC host, to verify #3137 start the app with the following option:
--btcNodes=32zzibxmqi2ybxpqyggwwuwz7a3lbvtzoloti7cxoevyvijexvgsfeid.onion:8333

You will be presented with the following:
image

After shutting down the app, restart it without the previous option and observe the BTC config. You will see the invalid custom BTC config but it will be using the provided BTC nodes.

image

This will allow for a custom validation error message to be defined,
particularly useful for providing a user-friendly message for regex
validation.
Ignored peers and BTC nodes input fields will now only accept IPv4 and
V2 onion addresses, with multiple addresses separated using a comma.
The shutdown popup was appearing when the BTC nodes input field lost
focus regardless if the input had changed or not.
If the user entered an invalid hostname for a custom BTC node, such as a
V3 onion address, after restarting Bisq they would be presented with an
error due to the node being unreachable and unable to continue nor
correct the config.

So now a warning message will be shown in this situation informing the
user of an invalid config and once they restart their client they will
connect to the provided BTC nodes.

Fixes bisq-network#3137
Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

It's good bisq can start to allow reconfig of btc nodes without it automatically connecting to the default nodes.

@sqrrm sqrrm merged commit 0ece6aa into bisq-network:master Jan 14, 2020
@ripcurlx ripcurlx added this to the v1.2.6 milestone Jan 16, 2020
@devinbileck devinbileck deleted the ignored-peers-and-btc-nodes branch January 18, 2020 06:54
@ripcurlx ripcurlx added the is:priority PR or issue marked with this label is up for compensation label Feb 5, 2020
@wiz
Copy link
Contributor

wiz commented Feb 9, 2020

@devinbileck it seems your new input validation is too strict, totally valid FQDNs like raspberrypi.local:8333 no longer work 😓

assertFalse(regexValidator.validate("onion:9999,abcdefghijklmnop.onion:9999").isValid);
assertFalse(regexValidator.validate("abcdefghijklmnop.onion:").isValid);
assertFalse(regexValidator.validate("32zzibxmqi2ybxpqyggwwuwz7a3lbvtzoloti7cxoevyvijexvgsfeid.onion:8333").isValid);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertTrue(regexValidator.validate("example.com").isValid);

@@ -1107,4 +1108,14 @@ public static MaterialDesignIcon getIconForSignState(AccountAgeWitnessService.Si
state.equals(AccountAgeWitnessService.SignState.PEER_SIGNER)) ?
MaterialDesignIcon.APPROVAL : MaterialDesignIcon.ALERT_CIRCLE_OUTLINE;
}

public static RegexValidator addressRegexValidator() {
RegexValidator regexValidator = new RegexValidator();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the regex to validate example.com here?

@wiz
Copy link
Contributor

wiz commented Feb 9, 2020

Also need to handle IPv6 addresses, i.e. [aaaa::bbbb]:8333 is a possible node address

@devinbileck
Copy link
Member Author

Thanks. I will submit a PR shortly.

devinbileck added a commit to devinbileck/bisq that referenced this pull request Feb 10, 2020
The original implementation of bisq-network#3895 did not validate IPv6 nor FQDN
addresses.
@devinbileck devinbileck mentioned this pull request Feb 10, 2020
ripcurlx pushed a commit to devinbileck/bisq that referenced this pull request Feb 11, 2020
The original implementation of bisq-network#3895 did not validate IPv6 nor FQDN
addresses.
ripcurlx pushed a commit that referenced this pull request Feb 11, 2020
The original implementation of #3895 did not validate IPv6 nor FQDN
addresses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:priority PR or issue marked with this label is up for compensation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bisq does not validate Bitcoin P2P node at configuration time
4 participants