-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
Fix permissions issues on main.queries and users.queries. #4400
Fix permissions issues on main.queries and users.queries. #4400
Conversation
Hi @corentin-soriano, it looks good to me, the fixes have resolved the vulnerabilities I reported. |
$data_user = DB::queryfirstrow( | ||
'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . ' | ||
WHERE email = %s', | ||
$post_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$post_id isn't initialized at this step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to replace $post_id
with $dataReceived['receipt']
// Manager of basic/ro users in this role but don't allow promote user to admin or managers roles | ||
|| ((int) $session->get('user-manager') === 1 | ||
&& in_array($data_user['isAdministratedByRole'], $session->get('user-roles_array')) | ||
&& (int) $post_is_admin !== 1 && (int) $data_user['admin'] !== 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for $post_is_admin, $post_is_hr and $post_is_manager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy/paste error.
We must check if the query returns a result and if the user has the right to administer the account found.
I will correct this tomorrow.
// Use id from session if user not admin or id not sent. | ||
$userId = $session->get('user-id'); | ||
} | ||
|
||
// Handle the case where no PWD is provided (user reset his own encryption keys). | ||
if (empty($dataReceived['user_pwd']) && (int) $userId === $session->get('user-id')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$userId is not initialized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$filtered_user
is expected.
$session->get('user-id')
instead of user input when only the user himself can perform this action.initialize_user_password
removed because it is unused.@tvnnn can you test this branch please?