Skip to content

[backport] Transaction viewer URL validation

Merge Instructions

Please squash using the description + test plan below for the squash commit message, including co-authored-by and below.

v v v


Co-authored-by: Andrew Stone g.andrew.stone@gmail.com

This is a partial backport of BCHUnlimited changes from GitLab MR 2401

bitcoinunlimited/BCHUnlimited!2401 (merged)

Summary

Enforces validation of the transaction viewer setting in Settings -> Options... -> Display such that only valid URLs starting with http or https are allowed. Hosts for existing invalid URLs in GUI configuration are also not displayed in the context menu anymore (blocked at startup).

Also add a unit test for the URL validation function.

Test plan:

  • ninja check-bitcoin-qt, check there are no Qt GUI unit test failures
  • Enter a URL that is invalid or does not start with http:// or https:// for the txviewer, and observe that it is refused with an error message: "Not a valid HTTP or HTTPS URL"
  • Enter a valid URL and restart the application, check that the host set in the configuration is displayed in the context menu in Transactions tab
  • Stop the application, and modify the strThirdPartyTxUrls configuration item in the [General] section of the appropriate GUI configuration file for the network on which you're testing. On Linux, these config files are typically stored under $HOME/.config/BitcoinCashNode/. Set this item to an invalid URL, e.g. one starting with ftp:// .
  • Restart the application and verify that the host of that URL is no longer displayed in the context menu.
  • Stop the GUI, correct the URL once more in the GUI config file, and restart. Verify that the host re-appears in the context menu.
Edited by freetrader

Merge request reports