Skip to content

[Security] Don't destroy the session on buggy php releases. #13286

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

Closed
wants to merge 2 commits into from

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Jan 6, 2015

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #13269, #13283
License MIT
Doc PR none

See #13269 for the discussion. This workaround avoids destroying the old session after login on the migrate strategy when running under a php version that we know to be broken.

Corresponding php bug: https://bugs.php.net/bug.php?id=63379

@xelaris
Copy link
Contributor

xelaris commented Jan 6, 2015

This would also "fix" issue #13283 and replaces the reverting PR #13282.

@andrerom
Copy link
Contributor

andrerom commented Jan 6, 2015

Are we positive Debian has not backported the php fix to their PHP 5.4.4 version? :)

@derrabus
Copy link
Member Author

derrabus commented Jan 6, 2015

@andrerom Good point. Since the bug does not have a security impact, I doubt that there is a backport. Same with RHEL/CentOS php 5.4.9. But I don't have either distribution as a VM right now to verfiy this.

In general, I'm not a friend of checking against the php version, but I can't see a different way of checking at runtime weather the php distribution is affected or not in this particullar case.

@andrerom
Copy link
Contributor

andrerom commented Jan 6, 2015

RHEL/CentOS uses 5.4.16 according to distrowatch
But your right, they tend to only backport non security fixes if they are fatal error / memory issues.

@fabpot
Copy link
Member

fabpot commented Jan 6, 2015

👍

@@ -39,6 +39,10 @@ public function testUnsupportedStrategy()

public function testSessionIsMigrated()
{
if (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50411) {
$this->markTestSkipped('We must not destroy the old session on php 5.4.0 - 5.4.10.');
Copy link
Member

Choose a reason for hiding this comment

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

the message should rather be cannot.

and instead of having 2 tests where one is always skipped while the other runs, shouldn't we have a single test with the version check in 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.

Well, but we can destroy the session. We would just run into trouble afterwards. 😉 Okay, I will change the message.

Yes, I can merge those tests again. I made two tests for the following reasons:

  • I'd like to keep logic (if/else) out of tests.
  • They are testing different behavior.
  • The second test can simply be dropped as soon as php 5.4 is not supported anymore.

Copy link
Member

Choose a reason for hiding this comment

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

Keeping two tests is fine by me.

@derrabus Can you update this PR so that I can merge it today and start releasing 2.6.2? Thank you very much.

@derrabus
Copy link
Member Author

derrabus commented Jan 7, 2015

I have updated the test.

@fabpot
Copy link
Member

fabpot commented Jan 7, 2015

Thank you @derrabus.

fabpot added a commit that referenced this pull request Jan 7, 2015
…. (derrabus)

This PR was squashed before being merged into the 2.3 branch (closes #13286).

Discussion
----------

[Security] Don't destroy the session on buggy php releases.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13269, #13283
| License       | MIT
| Doc PR        | none

See #13269 for the discussion. This workaround avoids destroying the old session after login on the migrate strategy when running under a php version that we know to be broken.

Corresponding php bug: https://bugs.php.net/bug.php?id=63379

Commits
-------

5d0b527 [Security] Don't destroy the session on buggy php releases.
@fabpot fabpot closed this Jan 7, 2015
@christickner
Copy link

Should we not also consider the Session::invalidate code as well? It makes an explicit call to Session::migrate:

public function invalidate($lifetime = null)
    {
        $this->storage->clear();

        return $this->migrate(true, $lifetime);
    }

@derrabus derrabus deleted the 2.3-13269 branch January 19, 2015 18:08
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.

6 participants