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

Move ini_set calls before a new session is started #32298

Merged
merged 1 commit into from
Aug 31, 2018

Conversation

DeepDiver1975
Copy link
Member

@DeepDiver1975 DeepDiver1975 commented Aug 10, 2018

Description

Alternative approach to #31525

Inspired by https://github.com/joomla/joomla-cms/pull/15742/files

Related Issue

How Has This Been Tested?

  • manually

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • Backport (if applicable set "backport-request" label and remove when the backport was done)

@codecov
Copy link

codecov bot commented Aug 10, 2018

Codecov Report

Merging #32298 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #32298      +/-   ##
============================================
- Coverage     64.01%   63.99%   -0.02%     
- Complexity    18560    18564       +4     
============================================
  Files          1171     1171              
  Lines         69837    69857      +20     
  Branches       1267     1267              
============================================
  Hits          44706    44706              
- Misses        24761    24781      +20     
  Partials        370      370
Flag Coverage Δ Complexity Δ
#javascript 52.84% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 65.27% <0%> (-0.03%) 18564 <5> (+4)
Impacted Files Coverage Δ Complexity Δ
lib/base.php 5.97% <ø> (+0.05%) 125 <0> (-1) ⬇️
lib/private/Session/Internal.php 0% <0%> (ø) 24 <5> (+5) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23c9335...194b9c5. Read the comment docs.

@patrickjahns
Copy link
Contributor

@DeepDiver1975

I don't quite understand why you move non-session related ini_set methods also into the session part

Wondering about the Request object "helper" -> we could follow the symfony approach where we create a request object early on before the "Kernel" is bootstrapped

https://symfony.com/doc/current/components/http_foundation.html#request

Example: https://github.com/Sylius/Sylius/blob/master/web/app.php#L23-L27

@DeepDiver1975
Copy link
Member Author

I don't quite understand why you move non-session related ini_set methods also into the session part

I was a bit overmotivated as it seems ... 🤕

Wondering about the Request object "helper" -> we could follow the symfony approach where we create a request object early on before the "Kernel" is bootstrapped

Our request object is already too big and has too much dependencies - initializing the request object at the wrong point in time leads to severe issues .....

@DeepDiver1975
Copy link
Member Author

@patrickjahns please review once more - thx

@patrickjahns
Copy link
Contributor

Our request object is already too big and has too much dependencies - initializing the request object at the wrong point in time leads to severe issues .

Hence the idea to have a slim Request::createFromGlobals(); -> all other things on the request should be set over time

If we think about a Middleware Handler approach, with each Middleware the request object could be either extended or wrapped to be passend down the line with more information.

So we get rid of the request object dependencies and have a clear request -> response cycle


private function start(): void {
if (@\session_id() === '') {
// prevents javascript from accessing php session cookies
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is just a code move - but do we have more information why this is? Wondering if this still holds true today

Copy link
Member Author

Choose a reason for hiding this comment

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

This comment is basically just copied over from the php docs - http://php.net/manual/en/session.security.ini.php

@DeepDiver1975
Copy link
Member Author

Hence the idea to have a slim Request::createFromGlobals(); -> all other things on the request should be set over time

If we think about a Middleware Handler approach, with each Middleware the request object could be either extended or wrapped to be passend down the line with more information.

So we get rid of the request object dependencies and have a clear request -> response cycle

fully understood the concept - no need to explain - question is how to do the transition. We basically need to remove the csrf check from IRequest - then the dependency cylce issue is gone.

Not that critical ... we need to double check -> different PR

@DeepDiver1975 DeepDiver1975 mentioned this pull request Aug 14, 2018
9 tasks
@patrickjahns
Copy link
Contributor

Not that critical ... we need to double check -> different PR

👍

So for this PR to merge - I wonder if can get ui tests to run with https. That way the cookie change to move to https would be tested in the sessions.

Needs some investigation @phil-davis @individual-it

@individual-it
Copy link
Member

@patrickjahns there are ways to auto accept self signed SSL certificates in selenium, would need a practical try to see if they work for us

@individual-it
Copy link
Member

opened issue for running tests with SSL: owncloud/QA#581

@patrickjahns
Copy link
Contributor

@DeepDiver1975
For approving I really would like to see https running - otherwise the change in behavior wouldn't be tested

Copy link

@miqrogroove miqrogroove left a comment

Choose a reason for hiding this comment

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

Works for me.

@PVince81
Copy link
Contributor

@patrickjahns merge for master but block backport until acceptance tests are there ?

having it in master will at least have this run on developers envs which might confirm further that it works

Copy link
Contributor

@patrickjahns patrickjahns left a comment

Choose a reason for hiding this comment

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

Merging for master 👍

@patrickjahns
Copy link
Contributor

@PVince81 - lets go ahead

@DeepDiver1975 DeepDiver1975 merged commit 35751f9 into master Aug 31, 2018
@DeepDiver1975 DeepDiver1975 deleted the bugfi/fix-ini_set branch August 31, 2018 09:33
@PVince81
Copy link
Contributor

stable10: #32538

@lock lock bot locked as resolved and limited conversation to collaborators Aug 31, 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.

PHP 7.2.5 ini_set(): A session is active
5 participants