Use $_SESSION instead of encrypted cookie.#249
Merged
Conversation
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.
This was referenced Jan 18, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is proposed that the security information is only stored in
$ _SESSIONand 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
$ _SESSIONitself.Code to access to
$ _SESSIONhas been centralized inphp/utilities/general.phpwrapping 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.