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

[Util] Better URL validation #2545

Merged
merged 2 commits into from
Sep 12, 2021

Conversation

random-zebra
Copy link

We validate (user side) the URL of budget proposals before their submission via RPC, and #soon via the GUI.

As noted by @NoobieDev12 in this comment, this URL validation is too limited. Essentially we are only checking that the string begins with the protocol.

This PR changes the implementation of the function validateURL() , using C++11 std::regex (which was the original intention of #950, but discarded to avoid bumping the minimum supported ABI at the time).

I've used the following pattern to match ^(https?)://[^\s/$.?#][^\s]*[^\s/.]\.[^\s/.][^\s]*[^\s.]$, which is far from a complete validation, but it should cover the basic cases.
We can refine it in the future if need be.

Unit tests included.

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

nice 👌 , utACK 13735da

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK 14f2239

@random-zebra random-zebra merged commit 129446a into PIVX-Project:master Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants