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

Use / instead of an empty string as cookie path #19010

Merged
merged 1 commit into from
Sep 14, 2015

Conversation

LukasReschke
Copy link
Member

When an empty string is used as cookie path PHP will assign the current directory as cookie path.

This means when an user had installed an ownCloud under "/", which is mapped to an empty string in \OC::$WEBROOT, and accessed it the cookie was set to values such as "/index.php/apps/files" since the web browser assumed this to be a directory. This means that multiple encryption cookies were set for the same domain resulting in potential havoc.

With this patch the path will be set to "/" in case an empty web root is installed which makes the cookie accessible to the whole domain.

To test this setup multiple ownCloud instances on the same domain under different ports and have both installed under "/", then try to login in both of it and previously this can in some cases lead to a lockout of the user.

Note that this affects the cookies that the browsers do sent and thus to test this you need to clear all cookies from your browser previously. I consider this an acceptable behaviour for now since this code is only in master.

Fixes #18919

When an empty string is used as cookie path PHP will assign the current directory as cookie path.

This means when an user had installed an ownCloud under "/", which is mapped to an empty string in \OC::$WEBROOT, and accessed it the cookie was set to values such as "/index.php/apps/files" since the web browser assumed this to be a directory. This means that multiple encryption cookies were set for the same domain resulting in potential havoc.

With this patch the path will be set to "/" in case an empty web root is installed which makes the cookie accessible to the whole domain.

To test this setup multiple ownCloud instances on the same domain under different ports and have both installed under "/", then try to login in both of it and previously this can in some cases lead to a lockout of the user.

Note that this affects the cookies that the browsers do sent and thus to test this you need to clear all cookies from your browser previously. I consider this an acceptable behaviour for now since this code is only in master.

Fixes #18919
@LukasReschke LukasReschke added this to the 8.2-current milestone Sep 14, 2015
@scrutinizer-notifier
Copy link

A new inspection was created.

@karlitschek
Copy link
Contributor

good catch. Makes total sense 👍

@oparoz
Copy link
Contributor

oparoz commented Sep 14, 2015

Tested and works, in my case with multiple sub-domains, all using "/". Also fixes #18891 for me.
👍

DeepDiver1975 added a commit that referenced this pull request Sep 14, 2015
Use / instead of an empty string as cookie path
@DeepDiver1975 DeepDiver1975 merged commit 341b733 into master Sep 14, 2015
@DeepDiver1975 DeepDiver1975 deleted the use-proper-web-root branch September 14, 2015 10:14
@lock lock bot locked as resolved and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Login not possible in some browsers under OS X.
5 participants