Skip to content

Conversation

@gfoidl
Copy link
Member

@gfoidl gfoidl commented Jan 5, 2020

Addresses #18109

@gfoidl
Copy link
Member Author

gfoidl commented Jan 5, 2020

/cc: @pranavkm


[Theory]
[InlineData("/\n")]
[InlineData("/\n/not-local-url")]
Copy link
Member Author

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...

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK, HttpRespose.Headers will complain if it sees control characters anywhere a header value. We could choose to emulate it in this code.

@Tratcher \ @blowdart what do you think?

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member

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)

Copy link
Member Author

@gfoidl gfoidl Jan 7, 2020

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.

@Pilchie Pilchie added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jan 6, 2020
@pranavkm pranavkm added this to the 5.0.0-preview1 milestone Jan 6, 2020
@pranavkm pranavkm self-assigned this Jan 6, 2020
@mkArtakMSFT mkArtakMSFT removed this from the 5.0.0-preview4 milestone May 18, 2020
@mkArtakMSFT
Copy link
Contributor

@pranavkm what is pending here? have all the concerns been addressed?

@mkArtakMSFT mkArtakMSFT added the community-contribution Indicates that the PR has been added by a community member label Jul 20, 2020
@pranavkm
Copy link
Contributor

pranavkm commented Sep 9, 2020

Thanks for the PR @gfoidl. We resolved this as part of #25378

@pranavkm pranavkm closed this Sep 9, 2020
@gfoidl gfoidl deleted the urlhelperbase-control-char branch September 10, 2020 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants