forked from wallabag/wallabag
AnnotationController: fix improper authorization vulnerability
This PR is based on 2.5.x branch. We fix the improper authorization by retrieving the annotation using id and user id. We also replace the ParamConverter used to get the requested Annotation on put and delete actions with an explicit call to AnnotationRepository in order to prevent a resource enumeration through response discrepancy. Fixes GHSA-mrqx-mjc4-vfh3 Co-authored-by: Jeremy Benoist <jeremy.benoist@gmail.com> Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
@ -932,7 +932,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$annotationsReset = $em
|
||||
->getRepository('WallabagAnnotationBundle:Annotation')
|
||||
->findAnnotationsByPageId($entry->getId(), $user->getId());
|
||||
->findByEntryIdAndUserId($entry->getId(), $user->getId());
|
||||
|
||||
$this->assertEmpty($annotationsReset, 'Annotations were reset');
|
||||
|
||||
@ -1040,7 +1040,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$annotationsReset = $em
|
||||
->getRepository('WallabagAnnotationBundle:Annotation')
|
||||
->findAnnotationsByPageId($annotationArchived->getId(), $user->getId());
|
||||
->findByEntryIdAndUserId($annotationArchived->getId(), $user->getId());
|
||||
|
||||
$this->assertEmpty($annotationsReset, 'Annotations were reset');
|
||||
}
|
||||
@ -1097,7 +1097,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$annotationsReset = $em
|
||||
->getRepository('WallabagAnnotationBundle:Annotation')
|
||||
->findAnnotationsByPageId($entry->getId(), $user->getId());
|
||||
->findByEntryIdAndUserId($entry->getId(), $user->getId());
|
||||
|
||||
$this->assertEmpty($annotationsReset, 'Annotations were reset');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user