Commit 2881bda3 authored by Jonathan Huot's avatar Jonathan Huot Committed by Dridi Boukelmoune

Fix indentation

parent 7387ecb5
sub samesite { sub samesite {
# See list here: # See list here:
# https://www.chromium.org/updates/same-site/incompatible-clients # https://www.chromium.org/updates/same-site/incompatible-clients
unset req.http.X-UA-SameSiteNone; unset req.http.X-UA-SameSiteNone;
set req.http.X-UA-SameSiteNone = "supported"; set req.http.X-UA-SameSiteNone = "supported";
# Versions of Chrome from Chrome 51 to Chrome 66 (inclusive on both ends). These Chrome versions will reject a cookie with `SameSite=None` # Versions of Chrome from Chrome 51 to Chrome 66 (inclusive on both ends). These Chrome versions will reject a cookie with `SameSite=None`
if (req.http.user-agent ~ "Chrom(e|ium)" && if (req.http.user-agent ~ "Chrom(e|ium)" &&
......
...@@ -17,7 +17,7 @@ server s1 -repeat 2 { ...@@ -17,7 +17,7 @@ server s1 -repeat 2 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
include "${projectdir}/samesite.vcl"; include "${projectdir}/samesite.vcl";
sub vcl_deliver { sub vcl_deliver {
call samesite; call samesite;
if (resp.http.set-cookie && if (resp.http.set-cookie &&
resp.http.set-cookie ~ "ThirdPartyCookie=" && resp.http.set-cookie ~ "ThirdPartyCookie=" &&
...@@ -26,44 +26,44 @@ varnish v1 -vcl+backend { ...@@ -26,44 +26,44 @@ varnish v1 -vcl+backend {
if (req.http.X-UA-SameSiteNone == "supported") { if (req.http.X-UA-SameSiteNone == "supported") {
set resp.http.Set-Cookie = resp.http.set-cookie + ";SameSite=None"; set resp.http.Set-Cookie = resp.http.set-cookie + ";SameSite=None";
} }
} }
} }
} -start } -start
# test with browser which does not support SameSite=None # test with browser which does not support SameSite=None
client c1 { client c1 {
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130" txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130"
rxresp rxresp
expect resp.http.Set-Cookie == "FirstPartyCookie=foobar" expect resp.http.Set-Cookie == "FirstPartyCookie=foobar"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130" txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130"
rxresp rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar" expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130" txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130"
rxresp rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;Path=/;Secure" expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;Path=/;Secure"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130" txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130"
rxresp rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=lax" expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=lax"
} -run } -run
# test with browser which support SameSite=None # test with browser which support SameSite=None
client c1 { client c1 {
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130" txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130"
rxresp rxresp
expect resp.http.Set-Cookie == "FirstPartyCookie=foobar" expect resp.http.Set-Cookie == "FirstPartyCookie=foobar"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130" txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130"
rxresp rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=None" expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=None"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130" txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130"
rxresp rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;Path=/;Secure;SameSite=None" expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;Path=/;Secure;SameSite=None"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130" txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130"
rxresp rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=lax" expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=lax"
} -run } -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment