Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] add checkTldDns option to UrlValidator #46921

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

Closed
wants to merge 1 commit into from

Conversation

astepin
Copy link
Contributor

@astepin astepin commented Jul 12, 2022

Q A
Branch? 6.2
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #39986
License MIT
Doc PR symfony/symfony-docs#...

With Symfony 5.0 the option "checkDns" was removed from the "UrlValidator" and the validator was completely changed to RegEx checks.
See: https://symfony.com/doc/4.4/reference/constraints/Url.html#checkdns

In issue #39986 it was noted that there is no way to check if this checked URL would really be usable.

While I can understand that individual DNS records might be temporarily unavailable, TLD name servers should generally always be available.

For this reason, I added the new option "checkTldDns" in this MR based on the option from Symfony 4.4 and earlier. This will perform a NS DNS query to the TLD of the checked URL.

Of course, this is still not an absolutely secure method but optionally allows to increase the security of the check.

If there is a chance that this will be added, I will be happy to write the doc for it as well.

@carsonbot
Copy link

It looks like you unchecked the "Allow edits from maintainer" box. That is fine, but please note that if you have multiple commits, you'll need to squash your commits into one before this can be merged. Or, you can check the "Allow edits from maintainers" box and the maintainer can squash for you.

Cheers!

Carsonbot

@carsonbot
Copy link

Hey!

I think @WojciechKania3 has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@fabpot
Copy link
Member

fabpot commented Jul 20, 2022

Checking the DNS is out of the scope for UrlValidator (which validates the syntax). In any case, we used to have this feature and it was deprecated (#25516) and removed (#31681) a while ago.
So, I'm closing as we won't re-introduce it (see https://github.com/symfony/symfony/pull/31681/files#diff-5b107354b610db5b8c104e7b1cb31b1dc93e0c377ab1d8ef35a90f25491b792eL115 for one additional reason).

@fabpot fabpot closed this Jul 20, 2022
@p4veI
Copy link

p4veI commented Jul 20, 2022

Checking the DNS is out of the scope for UrlValidator (which validates the syntax). In any case, we used to have this feature and it was deprecated (#25516) and removed (#31681) a while ago. So, I'm closing as we won't re-introduce it (see https://github.com/symfony/symfony/pull/31681/files#diff-5b107354b610db5b8c104e7b1cb31b1dc93e0c377ab1d8ef35a90f25491b792eL115 for one additional reason).

@fabpot just wondering, what is UrlValidator good for at this moment, since it validates basically any string as a valid url as mentioned in #39986 which is now closed.

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.

symfony/validator UrlValidator passes invalid urls
4 participants