-
Notifications
You must be signed in to change notification settings - Fork 134
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
Validate host/path pattern in Create Route form #2383
Conversation
Hey irfanhabib! Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex needs more work
@@ -33,7 +33,8 @@ import { Domain } from '../../../../store/types/domain.types'; | |||
import { Route, RouteMode } from '../../../../store/types/route.types'; | |||
import { ApplicationService } from '../../application.service'; | |||
|
|||
|
|||
const hostPattern = '(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])'; | |||
const pathPattern = `^((\/)${hostPattern}?(\/)*)*$`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the path allows more chars than the host. See: https://tools.ietf.org/html/rfc3986#section-3.3 and https://tools.ietf.org/html/rfc3986#appendix-A
@@ -33,7 +33,8 @@ import { Domain } from '../../../../store/types/domain.types'; | |||
import { Route, RouteMode } from '../../../../store/types/route.types'; | |||
import { ApplicationService } from '../../application.service'; | |||
|
|||
|
|||
const hostPattern = '(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct - it allows lots of invalid characters - e.g. /, % etc - see: https://en.wikipedia.org/wiki/Hostname for a simple explanation of what is allowed.
Codecov Report
@@ Coverage Diff @@
## v2-master #2383 +/- ##
=============================================
+ Coverage 71.04% 71.05% +<.01%
=============================================
Files 583 583
Lines 24452 24454 +2
Branches 5483 5483
=============================================
+ Hits 17373 17375 +2
Misses 7079 7079 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.