-
Notifications
You must be signed in to change notification settings - Fork 10.5k
UrlHelperBase.IsLocalUrl treats control characters correctly #18134
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
Conversation
|
/cc: @pranavkm |
|
|
||
| [Theory] | ||
| [InlineData("/\n")] | ||
| [InlineData("/\n/not-local-url")] |
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.
Are control characters at other places allowed? I.e. at the end, in the middle.
If so, we need to check the whole url for control characters...
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.
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.
Return false or throw if it has any controls? Returning false would be the most compatible.
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.
Return false. But basically apply the same checks as whatever HttpResponse.Headers applies to determine the validity.
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.
Anything less than 0x20, or 0x7F (Delete)
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.
Is checking the ascii-range [0x00, 0x7F] enough? As there are more control characters above 0x7F.
Subtraction by const and one compare, instead of two comparisons.
This reverts commit e4f6bc3.
|
@pranavkm what is pending here? have all the concerns been addressed? |
Addresses #18109