[1.x] fix: Logout controller allows open redirects#3948
Merged
Conversation
8d3da22 to
bf95872
Compare
askvortsov1
approved these changes
Jan 5, 2024
Member
askvortsov1
left a comment
There was a problem hiding this comment.
Would be nice to see an integration test, but otherwise the code makes sense!
luceos
requested changes
Jan 5, 2024
Member
luceos
left a comment
There was a problem hiding this comment.
Haven't tested this, but left some comments for improvement.
Member
Author
I did try, however we need to make some changes to For example: public function logout_with_forum_redirect(string $returnUrl)
{
$encodedReturnUrl = urlencode($returnUrl);
$response = $this->send(
$this->request('GET', '/logout?return=' . $encodedReturnUrl)
);
$this->assertEquals(302, $response->getStatusCode());
$this->assertEquals($returnUrl, $response->getHeaderLine('location'));
}This is a test I attempted to write for this, but we currently don't have the ability to pass the query, due to |
luceos
approved these changes
Jan 5, 2024
SychO9
pushed a commit
that referenced
this pull request
Oct 24, 2024
* fix: prevent open redirects on logout controller * use clearer config key * cast url as string, reinstate guest redirect * clean up a little * simplify * return Uri * resolve ternary always true * simplify some more * remove extra newline * handle malformed uri * chore: requested changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prevents open redirects on the
LogoutControllerBy default, only return URL's on the forum host are permitted. Additional domains may be whitelisted using
config.php: