diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-01-23 13:25:15 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-01-23 13:25:15 +0000 |
commit | 6e415f3c6d9355312b9fb84e4ecdb68f96cff618 (patch) | |
tree | 9e0c21f5408a7bb93007456673cb0b420855b977 | |
parent | 4aa74d4dc2208a4465d9e25921c4bfa3ec14c24a (diff) |
Remove SameSite=Lax from cookies.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Engine.pm | 68 | ||||
-rw-r--r-- | t/app/engine.t | 9 |
4 files changed, 0 insertions, 79 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b9283bcc..b84403b98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,6 @@ * Unreleased - Front end improvements: - - Include "SameSite=Lax" with all cookies. - Zoom out as much as necessary on body map page, even on mobile. #1958 - Bugfixes: - Fix bug specifying category in URL on /around. #1950 diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 390300093..e47336b7c 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -98,7 +98,6 @@ __PACKAGE__->config( ); __PACKAGE__->response_class('FixMyStreet::App::Response'); -__PACKAGE__->engine_class('FixMyStreet::App::Engine'); # Start the application __PACKAGE__->setup(); diff --git a/perllib/FixMyStreet/App/Engine.pm b/perllib/FixMyStreet/App/Engine.pm deleted file mode 100644 index b73701f49..000000000 --- a/perllib/FixMyStreet/App/Engine.pm +++ /dev/null @@ -1,68 +0,0 @@ -package FixMyStreet::App::Engine; - -use Moose; -extends 'Catalyst::Engine'; - -use CGI::Cookie; -use utf8; - -use namespace::clean -except => 'meta'; - -=head1 NAME - -FixMyStreet::App::Engine - Catalyst Engine wrapper - -=head1 SYNOPSIS - -See L<Catalyst::Engine>. - -=head1 METHODS - -=head2 $self->finalize_cookies($c) - -Create CGI::Cookie objects from C<< $c->res->cookies >>, and set them as -response headers. Adds a C<samesite=lax> part. - -=cut - -sub finalize_cookies { - my ( $self, $c ) = @_; - - my @cookies; - my $response = $c->response; - - foreach my $name (keys %{ $response->cookies }) { - - my $val = $response->cookies->{$name}; - - my $cookie = ( - blessed($val) - ? $val - : CGI::Cookie->new( - -name => $name, - -value => $val->{value}, - -expires => $val->{expires}, - -domain => $val->{domain}, - -path => $val->{path}, - -secure => $val->{secure} || 0, - -httponly => $val->{httponly} || 0, - -samesite => 'Lax', - ) - ); - if (!defined $cookie) { - $c->log->warn("undef passed in '$name' cookie value - not setting cookie") - if $c->debug; - next; - } - - push @cookies, $cookie->as_string; - } - - for my $cookie (@cookies) { - $response->headers->push_header( 'Set-Cookie' => $cookie ); - } -} - -__PACKAGE__->meta->make_immutable; - -1; diff --git a/t/app/engine.t b/t/app/engine.t deleted file mode 100644 index d99c5e087..000000000 --- a/t/app/engine.t +++ /dev/null @@ -1,9 +0,0 @@ -use FixMyStreet::Test; - -use Catalyst::Test 'FixMyStreet::App'; - -my $res = request("/?_override_foo=bar"); - -like $res->headers->header('Set-Cookie'), qr/SameSite=Lax/; - -done_testing; |