Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Security] Preserve URI fragment in HttpUtils::generateUri() #24203

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

Merged
merged 1 commit into from
Sep 17, 2017

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Sep 14, 2017

Q A
Branch? 3.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #23675
License MIT
Doc PR n/a

@linaori
Copy link
Contributor

linaori commented Sep 14, 2017

This way of url generating causes more issues as it simply throws in all attributes: linaori/http-bundle#25

@chalasr
Copy link
Member Author

chalasr commented Sep 14, 2017

@iltar we should open another issue for that

@@ -150,7 +150,16 @@ public function generateUri($request, $path)
// fortunately, they all are, so we have to remove entire query string
$position = strpos($url, '?');
if (false !== $position) {
$fragment = '';
Copy link
Member

Choose a reason for hiding this comment

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

Could we use http://php.net/parse_url here instead of this custom logic?

Copy link
Member Author

Choose a reason for hiding this comment

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

better thanks

@@ -150,7 +150,16 @@ public function generateUri($request, $path)
// fortunately, they all are, so we have to remove entire query string
Copy link
Member

Choose a reason for hiding this comment

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

Should we update this comment too?

Copy link
Member Author

Choose a reason for hiding this comment

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

dedicated comment added just before fragment handling

@chalasr chalasr force-pushed the auth-failure-path-keep-fragment branch from 0133c2e to 34b9475 Compare September 15, 2017 12:06
@@ -150,7 +150,12 @@ public function generateUri($request, $path)
// fortunately, they all are, so we have to remove entire query string
$position = strpos($url, '?');
if (false !== $position) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is that necessary? What about a path like /foo/bar#fragment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fragment gets stripped only if there is a query string, otherwise the urlGenerator result is returned directly

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the clarification, but maybe we should add a test for that too to prevent regressions?

Copy link
Contributor

Choose a reason for hiding this comment

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

In most cases there is always a query string, because it uses the attributes from the request to build it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@xabbuh Test added

@chalasr chalasr force-pushed the auth-failure-path-keep-fragment branch from 34b9475 to 4dd2e3e Compare September 15, 2017 13:18
@chalasr chalasr merged commit 4dd2e3e into symfony:3.3 Sep 17, 2017
chalasr pushed a commit that referenced this pull request Sep 17, 2017
…() (chalasr)

This PR was merged into the 3.3 branch.

Discussion
----------

[Security] Preserve URI fragment in HttpUtils::generateUri()

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23675
| License       | MIT
| Doc PR        | n/a

Commits
-------

4dd2e3e Preserve URI fragment in HttpUtils::generateUri()
@chalasr chalasr deleted the auth-failure-path-keep-fragment branch September 17, 2017 13:45
@fabpot fabpot mentioned this pull request Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.