Skip to content

Use $_SESSION instead of encrypted cookie.#249

Merged
jmueller17 merged 5 commits into
jmueller17:masterfrom
jorix:a_session-2
Jan 18, 2019
Merged

Use $_SESSION instead of encrypted cookie.#249
jmueller17 merged 5 commits into
jmueller17:masterfrom
jorix:a_session-2

Conversation

@jorix

@jorix jorix commented Jan 18, 2019

Copy link
Copy Markdown
Contributor

It is proposed that the security information is only stored in $ _SESSION and in this way it is avoided in the client contents a security data, even though it was encrypted.

The proposal no longer requires cookies, except for the $ _SESSION itself.

Code to access to $ _SESSION has been centralized in php/utilities/general.php wrapping any other access $ _SESSION, which allows managing the session destruction when suspicious situations occur.

A security hole has also been covered in all controllers, now the controls deny requests if the user is not properly identified.

This change allows Aixada to work with PHP 7.3 in most sections (For the rest see #248)
(is stop using mcrypt Aixada that is not longer supported by PHP7.1)

NOTE: This code has already been in production for two weeks.

The sensitive information is only saved in $ _SESSION and in this way it is avoided in the client cotens sensitive data even though it was encrypted.

On the other hand when you stop using mcrypt Aixada no longer fails for any page using PHP7.1 or higher.

This is a step to allow PHP7 to be used.
* Use php/ctrl/AixadaSession.php instead of Cookie.php
* Moves old part of code /inc/cookie.inc.php to /utilities/general.php
* Remove usage of `$_SESSION` in favor of the new code in `general.php`
* Use `validate_session()` in the controllers **to prevent its use without being logged in**.
User can continue on a Aixada page tried to make requests, but in another tab the session is logged out. Therefore, all controllers are responding to requests with error "Not logged in".

It is proposed to show a message and go to `login.php`.
(new method `AixadaNotLoggedInMsg` in `jquery.aixadaUtilities.js` to display this message that is depending on the language)
It is proposed to logout the session when:
* After 30 days of inactivity
* If there are requests to the same session from a different IP (but the router restart also force it)
* If there are requests to the same session from a different browser (but the browser update also force it)

At logout it also regenerates the session id to try to deactivate the session hijack attack.
This avoids closing all sessions when changing to this version.
@jmueller17 jmueller17 merged commit 1d7b2e6 into jmueller17:master Jan 18, 2019
@jorix jorix deleted the a_session-2 branch January 18, 2019 20:19
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.

2 participants