Review main Merged

32212[BUGFIX] rsaauth: remove session-cookie when no longer used

Stefan Neufeind CR +2 V +2 Easy +7 −0 updated 04/25/16, 13:36

Commit message

When deleting the rsa key from the database we now remove the PHP cookie
as well in order to keep the system cleaned up.

Review

  • Code review CR +2
    • Frank Nägler +2
    • Mathias Schreiber +1
  • Verified V +2
    • Frank Nägler +2
    • Stefan Neufeind +1
    • Mathias Schreiber +1
    • Nicole Hummel +1

Issues 1

Files 1

Review log 24

  1. Stefan Neufeind uploaded patch set 1 08/17/14, 23:09

  2. Stefan Neufeind commented on patch set 1 08/17/14, 23:14

    This patch tries to solve at least the easiest default-case. The default-session might be in use by others as well, so at least check if it's empty. If we could imho it might be better to use the regular FE/BE-user-cookies for this case. But to get the setting/unsetting right and not break something that might require a bit more work imho. Note that EXT:openid also contains a separate session_start()-call.
  3. Stefan Neufeind commented on patch set 1 08/17/14, 23:18

    Comment for class SplitStorage says that the idea is to store part of the key in DB and the other in the session. If we use the default-FE/BE-sessions then both parts would (usually) end up in DB.
  4. Stefan Neufeind commented on patch set 1 08/17/14, 23:24

    Since meanwhile we fetch (new) keys via AJAX right before the submit, do we need a session/cookie here at all? We could transfer the name of the "cookie" in a regular POST. We'd just need to store the second part of the session-key somewhere else, if we don't use sessions.
  5. Helmut Hummel commented on patch set 1 08/19/14, 10:33

    The Ajax call generates a private/public keypair, stores the private key partly in the db and partly in the session and sends the public key to the browser. This public key is then used to encrypt the password (in js) and the encrypted password is then sent via POST. In this POST request the password needs to be decrypted using the private key, so it is reconstructed from the session and db and then used to decrypt the encrypted password. There is NO way around that. The private key needs to be stored in an as secure as possible place. The only way to avoid using a PHP session is to allow register different private key storage classes. An alternative to storing it in the PHP session (which writes a file on disc) I can imagine is to store on part of the key directly as a file. Since the location of the file needs to be outside the document root and we cannot guess where such a place is, the file path would need to be specified.
  6. Stefan Neufeind commented on patch set 1 08/19/14, 11:08

    Result from a short discussion with Helmut: It "might be" okay to remove the session as suggested here. But we can't be 100% sure, since it might also be something else that started this session. Thus removing the cookie "might" be breaking for some special case. Solution to get rid of using a cookie at all might be a good way, since that key is really just stored there temporarily between the AJAX-request and the POST-request. We still need some separate place to store part of the key (other than DB), so writing it to a file instead of the session might be an option. For that we'd however need a secure, temporary storage for files (preferably outside docroot), so typo3temp is not an option. That path would need to be configurable then.
  7. Benni Mack commented on patch set 1 12/08/14, 07:19

    Stefan, what do you suggest here then? Keep this issue open for references? And then make sure to get TYPO3 out of the webroot? Seems like not solvable. Or we add an option if we want to remove the session cookie?
  8. Mathias Schreiber wrote 12/17/14, 14:33

    Topic set to EXT: rsaauth
  9. Alexander Opitz commented on patch set 1 06/18/15, 12:28

    Maybe storing it in the temp directory of the system with sys_get_temp_dir ?
  10. Oliver Hader uploaded patch set 2 10/09/15, 12:58

  11. Stefan Neufeind commented on patch set 2 10/15/15, 23:43

    @Benni: Imho it's not possible (with every provider) to move TYPO3 out of the webroot. But besides that, as long as we keep using sessions imho we should find a way to remove it again as soon as it is not needed anymore.
  12. Dmitry Dulepov commented on patch set 2 11/02/15, 11:52

    I have questions (see the code).

    SplitStorage.php:86

    Second parameter should be a string: http://php.net/setcookie Shouldn't lifetime be in the past?
  13. Alexander Opitz commented on patch set 2 11/02/15, 13:32

    SplitStorage.php:86 Reply

    See the "Common Pitfalls" section on the linked page.
  14. Stefan Neufeind commented on patch set 2 11/02/15, 14:23

    SplitStorage.php:86 Reply

    Afaik I tested it with false. But according to the docs an empty string should also be okay.
  15. Benni Mack commented on patch set 2 CR -1 11/29/15, 21:39

    The branch is "6.3" and "6.2" - if this is not a critical issue, I would go with master-only. Please adapt accordingly.
  16. Benni Mack commented on patch set 2 03/31/16, 07:30

    ping Stefan, no movement since November. Although this one is a nice change, please add some more info to the commit message, and change the Releases line, if you're still interested in getting this patch in (or somebody else wants to step up)
  17. Mathias Schreiber commented on patch set 3 04/09/16, 19:00

    Published edit on patch set 2.
  18. Mathias Schreiber voted on patch set 3 CR +1 V +1 04/09/16, 19:00

  19. Stefan Neufeind commented on patch set 3 V +1 04/09/16, 19:57

    Thanks for taking care. Didn't find the time lately unfortunately. I've retried the patch. Seems to work for me as expected. * What works as expected: Upon opening the login-dialog I get a PHPSESSID. After successful login that cookie is removed. * What works but I didn't expect this way: After a failed login the cookie is gone as well - but the login still works?
  20. Nicole Hummel voted on patch set 3 V +1 04/21/16, 17:03

  21. Frank Nägler voted on patch set 3 CR +1 04/22/16, 07:18

  22. Frank Nägler voted on patch set 3 CR +2 V +2 04/25/16, 13:36

  23. Gerrit merged patch set 3 04/25/16, 13:36

  24. Frank Nägler commented on patch set 4 04/25/16, 13:36

    Cherry Picked This patchset was cherry picked to branch TYPO3_7-6 as commit 5030353ae3ef084f95aaf2ca5e0c929ab12b7d6a