Skip to content

Commit 32d7459

Browse files
author
Dolicraft
committed
Fix Dolibarr#39063 enforce user write right on other users notes
The note editor set $permissionnote from user->self->write only, so a user holding user->user->read plus user->self->write (but not user->user->write) could edit the public/private notes of any user, admins included: the setnote actions are not in restrictedArea's write-check list, so $permissionnote was the only remaining guard. It now requires user->user->write to edit another user's notes, matching caneditfield in user/card.php. Reported by Abderrahmane Aksoum. Signed-off-by: Dolicraft <contact@dolicraft.com>
1 parent 20b4edc commit 32d7459

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

htdocs/user/note.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
}
5151

5252
// Permissions
53-
$permissionnote = $user->hasRight("user", "self", "write"); // Used by the include of actions_setnotes.inc.php
53+
// Writing notes on own record needs the "self" write right, writing on another user's record needs the "user" write right.
54+
// Without this distinction a user holding only "self" write could edit the notes of any user, including admins.
55+
$permissionnote = ((($object->id == $user->id) && $user->hasRight("user", "self", "write")) || (($object->id != $user->id) && $user->hasRight("user", "user", "write"))); // Used by the include of actions_setnotes.inc.php
5456

5557
// Security check
5658
$socid = 0;

0 commit comments

Comments
 (0)