mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
Protect star_entry with a CSRF token
This commit is contained in:
parent
edffef8375
commit
00d0e6f951
6 changed files with 47 additions and 13 deletions
|
@ -467,12 +467,16 @@ class EntryController extends AbstractController
|
|||
/**
|
||||
* Changes starred status for an entry.
|
||||
*
|
||||
* @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry")
|
||||
* @Route("/star/{id}", name="star_entry", methods={"POST"}, requirements={"id" = "\d+"})
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function toggleStarAction(Request $request, Entry $entry)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('star-entry', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$this->checkUserAction($entry);
|
||||
|
||||
$entry->toggleStar();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue