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

Add support for URL wildcards and exact URL #9835

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

varjolintu
Copy link
Member

@varjolintu varjolintu commented Sep 12, 2023

Adds support for URL wildcards and exact URL if the address is wrapped insinde " e.g. "https://example.com/page.php". Without wildcards, URL's are handled normally with the old/current implementation.

This feature is restricted to Additional URLs only, because storing URLs in wildcard form is not recommended, and it breaks the possibility to open the URL to a browser.

The wildcards can be used freely, and some example addresses are:

  • https://*.example.com/page/*
  • https://192.*.168.1/
  • subdomain.of.*.example.com/page/*/login

Fixes #3718.

Testing strategy

Manually, and added automatic tests.

Type of change

  • ✅ New feature (change that adds functionality)

@varjolintu varjolintu added this to the v2.8.0 milestone Sep 12, 2023
@varjolintu varjolintu changed the title Ddd support for URL wildcards and exact URL Add support for URL wildcards and exact URL Sep 12, 2023
@varjolintu varjolintu marked this pull request as draft September 12, 2023 07:20
@mfrakka

This comment has been minimized.

@varjolintu

This comment has been minimized.

@mfrakka

This comment has been minimized.

@mfrakka

This comment has been minimized.

@mfrakka

This comment has been minimized.

@droidmonkey

This comment has been minimized.

@mfrakka

This comment has been minimized.

@varjolintu
Copy link
Member Author

varjolintu commented Dec 4, 2023

TODO: Check if using https://doc.qt.io/qt-6/qregularexpression.html#wildcardToRegularExpression is preferred after Qt6 upgrade. Qt5 does not support https://doc.qt.io/qt-6/qregularexpression.html#WildcardConversionOption-enum.

@droidmonkey
Copy link
Member

Oh nice that will likely replace one of our tools functions.

@droidmonkey
Copy link
Member

droidmonkey commented Jan 12, 2025

@varjolintu can you rebase this onto develop?

Also want to make the change that wildcards are only valid in the "extra urls" and not the main url so click to open will still work.

@varjolintu
Copy link
Member Author

@varjolintu can you rebase this onto develop?

Also want to make the change that wildcards are only valid in the "extra urls" and not the main url so click to open will still work.

This change would be very welcome. I was also concerned about this if wildcards are used in the main URLs.

@varjolintu varjolintu force-pushed the feature/add_support_for_url_wildcards branch from 9ab03a5 to 55ddd9d Compare January 12, 2025 20:38
@varjolintu varjolintu force-pushed the feature/add_support_for_url_wildcards branch from 55ddd9d to a20fa8e Compare January 21, 2025 14:41
@varjolintu
Copy link
Member Author

varjolintu commented Jan 21, 2025

Made the necessary changes. Wildcards and exact URL is now only supported in the Additional URLs section.
UrlTools::isValidUrl() needed some extra handling for the loose comparison.

@droidmonkey droidmonkey force-pushed the feature/add_support_for_url_wildcards branch from 1575ac5 to 029f28a Compare February 1, 2025 17:15
@droidmonkey
Copy link
Member

@varjolintu do you think this is ready for 2.7.10?

@varjolintu
Copy link
Member Author

@varjolintu do you think this is ready for 2.7.10?

I think so. Only thing I was wondering is that should we prevent Additional URLs that are just * or *.com etc. But then again, it's up to the user what to use.

@droidmonkey
Copy link
Member

droidmonkey commented Feb 2, 2025

I do believe there should at least be a root host and TLD, otherwise you are opening this feature up to phishing attacks. We can allow it but show the "red not valid" background color. Nothing really prevents the user from entering a broken url.

tests/TestUrlTools.cpp Outdated Show resolved Hide resolved
src/gui/UrlTools.cpp Outdated Show resolved Hide resolved
src/gui/UrlTools.cpp Outdated Show resolved Hide resolved
@varjolintu varjolintu force-pushed the feature/add_support_for_url_wildcards branch from 029f28a to 590cd3c Compare February 3, 2025 06:12
@Shnoulle

This comment was marked as off-topic.

@varjolintu

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: Browser pr: new feature Pull request that adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow limited wildcard matching for Browser Integration URLs
5 participants