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

feat(isFQDN): add allow_wildcard option #1647

Merged
merged 1 commit into from Oct 30, 2021

Conversation

fasenderos
Copy link
Contributor

Added the allow_wildcard option for isFQDN. Now the validator can allow domain starting with *. (e.g. *.example.com or *.shop.example.com).
Fixes #1646

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)

@codecov
Copy link

codecov bot commented Apr 16, 2021

Codecov Report

Merging #1647 (b2fff10) into master (a31c116) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1647   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          100       100           
  Lines         1843      1845    +2     
=========================================
+ Hits          1843      1845    +2     
Impacted Files Coverage Δ
src/lib/isFQDN.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a31c116...b2fff10. Read the comment docs.

@ezkemboi ezkemboi added ready-to-land For PRs that are reviewed and ready to be landed 🎉 first-pr labels Apr 17, 2021
Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

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

Not quite sure about the validity of this one; will we violating FQDN in principle? Can we leave this to the user to clean out the *. before sending in the rest to isFQDN?

@fasenderos
Copy link
Contributor Author

fasenderos commented Apr 17, 2021

@profnandaa I’m using validator.js on backend (NestJs with class-validator that hunder the hood use validator.js) to validate DTO on Rest API. So in my case it’s perfectly valid to let client send domain with wildcard. Alternatively I should use some ugly regex. Even more wildcard FQDN is commonly used e.g. on SSL certificate and Firewall, and i think it can be helpful for such frontend application. I hope this PR will be merged soon.

@profnandaa
Copy link
Member

@tux-tn -- please have a look and advise.

@fasenderos
Copy link
Contributor Author

@tux-tn @profnandaa any updates here? Would love to see this!

@fasenderos
Copy link
Contributor Author

@profnandaa and @ezkemboi please ignore the reviews requests, were made by mistake. Sorry

@profnandaa
Copy link
Member

@tux-tn -- could you please have a look at this?

@cowboy-bebug
Copy link
Contributor

Why is it difficult to remove this specific pattern?

"*.example.com".replace(/^\*\./, "")

I hope this doesn't introduce any potential exploits 🤞

@fasenderos
Copy link
Contributor Author

My intent here is not to sanitize the input, but to validate the input client side. Sanitization eventually comes as a backend stuff

Copy link
Member

@tux-tn tux-tn left a comment

Choose a reason for hiding this comment

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

LGTM 🎉
Sorry for the late review 😅

Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, will be getting this in. I'm staging the release this weekend for final check off by the maintainers on Monday/Tuesday and we make the release.

@profnandaa profnandaa merged commit 622184e into validatorjs:master Oct 30, 2021
theteladras pushed a commit to theteladras/validator.js that referenced this pull request Oct 30, 2021
Co-authored-by: Andrea Fassina <andrea.fassina@nativery.com>
profnandaa pushed a commit that referenced this pull request Oct 31, 2021
Co-authored-by: Andrea Fassina <andrea.fassina@nativery.com>
profnandaa pushed a commit that referenced this pull request Oct 31, 2021
Co-authored-by: Andrea Fassina <andrea.fassina@nativery.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍿 discussion 🎉 first-pr ready-to-land For PRs that are reviewed and ready to be landed 🕑 to-be-reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for FQDN validation with wildcard
6 participants