Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

Define all Cookie arguments explicitly #58

Merged
merged 4 commits into from May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion EventListener/AngularCsrfCookieListener.php
Expand Up @@ -102,7 +102,9 @@ public function onKernelResponse(FilterResponseEvent $event)
$this->cookiePath,
$this->cookieDomain,
$this->cookieSecure,
false
false /* httpOnly */,
false /* raw */,
Cookie::SAMESITE_LAX
));
}
}
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -10,7 +10,7 @@ init:

install:
- ps: Set-Service wuauserv -StartupType Manual
- cinst -y php
- cinst -y php --version 7.2.17
- cd c:\tools\php72
- copy php.ini-production php.ini /Y
- echo date.timezone="UTC" >> php.ini
Expand Down
Expand Up @@ -60,6 +60,11 @@ public function it_loads(ContainerBuilder $container, ParameterBagInterface $par
$container->addResource(Argument::type('Symfony\Component\Config\Resource\FileResource'))->shouldBeCalled();
}

if (method_exists('Symfony\Component\DependencyInjection\ContainerBuilder', 'addRemovedBindingIds')) {
// Added in Symfony v4.2.6 and v3.4.25
$container->addRemovedBindingIds(Argument::type('string'))->willReturn(null);
}

$container->getParameterBag()->willReturn($parameterBag)->shouldBeCalled();
$container->hasExtension('http://symfony.com/schema/dic/services')->willReturn(false)->shouldBeCalled();
$container->setParameter('dunglas_angular_csrf.token.id', $configs['dunglas_angular_csrf']['token']['id'])->shouldBeCalled();
Expand Down
Expand Up @@ -79,7 +79,10 @@ public function it_sets_cookie_when_it_does(
Response $response,
ResponseHeaderBag $headers
) {
$headers->setCookie(Argument::type('Symfony\Component\HttpFoundation\Cookie'));
$headers->setCookie(Argument::allOf(
Argument::type('Symfony\Component\HttpFoundation\Cookie'),
Argument::which('getSameSite', 'lax')
))->shouldBeCalled();
$response->headers = $headers;

$event->getRequestType()->willReturn(HttpKernelInterface::MASTER_REQUEST)->shouldBeCalled();
Expand Down