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

[essentials] ensure WebUtils.ParseQueryString captures fragment parameters #15662

Merged

Conversation

rdavisau
Copy link
Contributor

Description of Change

Makes WebUtils.ParseQueryString extract parameters from both Uri.Query and Uri.Fragment, resolving a regression from net8p4 to net8p5.

Issues Fixed

Fixes #15661

@ghost ghost added the community ✨ Community Contribution label Jun 15, 2023
@ghost
Copy link

ghost commented Jun 15, 2023

Hey there @rdavisau! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@rdavisau
Copy link
Contributor Author

@dotnet-policy-service agree

@jsuarezruiz jsuarezruiz added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Jun 15, 2023
@jfversluis jfversluis requested a review from jstedfast June 26, 2023 09:48
@jfversluis
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jstedfast
Copy link
Member

My understanding is that query parameters MUST come before the URI fragment (which can only be terminated by the end of the URI).

https://www.rfc-editor.org/rfc/rfc3986#section-3.5

Can you show me where my interpretation is wrong?

There's also this syntax: URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] which, again, indicates that the fragment is always last.

Copy link
Member

@jstedfast jstedfast left a comment

Choose a reason for hiding this comment

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

Before this gets merged, lets make sure that it is valid to have a query string located within the fragment of a URI. I don't believe that it is valid.

@rdavisau
Copy link
Contributor Author

Maybe the confusion comes from the name of the method WebUtils.ParseQueryString?

Originally, (despite the name) it had the behaviour of "extract all parameters from the url" and handled parameters whether they were in query string and/or fragment. That's covered by tests for the class and is also mentioned as the expected behaviour here. The perf change made ParseQueryString only extract from the query string, which is consistent with the name of the method, but fails the fragment test and breaks existing users of WebAuthenticator that rely on it handling parameters contained in a fragment of the auth response. This PR aims to undo that regression specifically. The ParseQueryString method is not part of the public API so I think it could be ok to rename.

@jstedfast
Copy link
Member

Well, based on the comment that specifically states that it is meant to parse the fragment as if it contained query parameters, then I guess the correct solution here is to parse both sets as your patch does.

@jstedfast jstedfast merged commit 3b8e484 into dotnet:main Jun 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.6.8686 Look for this fix in 8.0.0-preview.6.8686! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info community ✨ Community Contribution fixed-in-8.0.0-preview.6.8686 Look for this fix in 8.0.0-preview.6.8686!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebAuthenticator does not extract parameters contained in a fragment (regression)
5 participants