8000 [Security][CSRF] Double Submit Cookies CSRF prevention strategy by backbone87 · Pull Request #18333 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security][CSRF] Double Submit Cookies CSRF prevention strategy #18333

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

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
implement EventSubscriberInterface into CookieTokenStorageListener
  • Loading branch information
backbone87 committed Sep 24, 2016
commit 893fa0c1a57c68860234bd3bcda1abddbf4eb964
9B87
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
namespace Symfony\Component\Security\Csrf\TokenStorage;

use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* Checks the request's attributes for a CookieTokenStorage instance. If one is
Expand All @@ -22,7 +24,7 @@
*
* @author Oliver Hoff <oliver@hofff.com>
*/
class CookieTokenStorageListener
class CookieTokenStorageListener implements EventSubscriberInterface
{
/**
* @var string
Expand Down Expand Up @@ -54,4 +56,14 @@ public function onKernelResponse(FilterResponseEvent $event)
$headers->setCookie($cookie);
}
}

/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return array(
KernelEvents::RESPONSE => array(array('onKernelResponse', 0)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 is needless

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure, if this will be the actual priority used in the end.

);
}
}
0