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

Modify NativeFileSessionHandler to avoid open_basedir issue with default session path #2598

Merged
merged 1 commit into from
Jun 17, 2015
Merged

Modify NativeFileSessionHandler to avoid open_basedir issue with default session path #2598

merged 1 commit into from
Jun 17, 2015

Conversation

acohin
Copy link
Contributor

@acohin acohin commented Jun 16, 2015

Hit the same snag with open_basedir restrictions as described in issue #2579. The trouble is with the Symfony session file storage handler checking the existence of the session path.

This is useful when a website has its own session path, but in many distributions the default session path is shared over the entire server (e.g. /var/lib/php5 in Debian, which also has its own garbage collection implementation tied in with that).

Complementing open_basedir restrictions make sure that runtime code is unable to read session data, as it has no business there from a security perspective. Turning off open_basedir restrictions on such a path will make any session data unnecessary vulnerable to things like remote file inclusion.

Also, in such a situation it is safe to assume the session path always exists, making checking it unnecessary as usually file system permissions prohibit creating a new directory in that location anyway.

This patch modifies the Symfony NativeFileSessionHandler by adding a little exception handling, which takes care of the open_basedir restriction only when the default session path is used. When a session path is specified through config the developer is responsible for making sure that it is within restrictions.

aembler added a commit that referenced this pull request Jun 17, 2015
Modify NativeFileSessionHandler to avoid open_basedir issue with default session path
@aembler aembler merged commit 0779801 into concretecms:develop Jun 17, 2015
@aembler
Copy link
Member

aembler commented Jun 17, 2015

Thanks!

@martinsanders
Copy link

Saved many hours of head scratching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants