Needs review
Project:
Drupal core
Version:
main
Component:
routing system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Mar 2016 at 21:50 UTC
Updated:
18 Aug 2026 at 11:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #4
pmchristensen commentedThanks for your awesome work Mac_Weber
As part of reviewing your patch for #2652236: Insufficient link validation for external URLs I realized that my problem was related to the formElement url and not the renderElement link.
Taken your description into consideration and your own patch for Issue 2652236, I made a patch which address most of the description - haven't checked Symfony
UrlValidator.I'll put this issue into Needs work as I think we should look into using a library as you suggest. But now we have something to start from and the possibility to use UrlHelper and get punycode validation for the host/domain.
Comment #6
dawehnerLet's see first whether we have some test failures.
Comment #8
wolffereast commentedOne note on the protocol handling in the initial patch. If we override the protocols by calling
UrlHelper::setAllowedProtocols(['ftp', 'http', 'https', 'feed']);immediately before doing the validation it trumps any changes made to the protocol list by external calls to setAllowedProtocols. Is allowing external calls to setAllowedProtocols a security risk? If so then we should protect the method, and if not then I propose rerolling the patch with the call to setAllowedProtocols removed.Comment #14
colanComment #17
wombatbuddy commentedAlso, I found out that you can enter url several times, for instance like this:
https://www.facebook.com/https://www.facebook.com/
Comment #18
quietone commentedRemoved related issue that is listed twice
Comment #24
casaran commentedPatch for 10.2.5 if anyone is interested.
Comment #26
codebymikey commentedFrom some local testing, using the
UrlValidatorapproach works with handling most cases by switching the logic to:But currently fails if the domain portion of the domain is encoded.
Relevant upstream issues:
So it might be easier to update the regex rather than relying on an external library, or alternatively use
parse_url()to validate that the URL has a valid scheme etc.Comment #28
codebymikey commentedSwitched to using Symfony's URL validator for this, so it better supports international domains better.
Tests seem to pass for me locally, but not sure what's going on with CI. Is anyone familiar if Drupal Components need special handling or something as I can't access the composer job artifacts to inspect?