summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorxXx-caillou-xXx2017-12-18 16:27:00 +0100
committerjvoisin2017-12-18 16:27:00 +0100
commitf70bd2eafc2fdac9fa528a3e649db0178c601b41 (patch)
tree5bde4b106b3e24a49bdb061c9eca2ecfe68b9bbc /src/tests
parent75f876fca7587218fdbad9bd10bbe52825591ccc (diff)
Fix cookie encryption
Previously, when a cookie was set with the `httpOnly` flag, it was automatically encrypted, due to a logic flaw. This is now fixed and tested.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/config/config_samesite_cookies.ini2
-rw-r--r--src/tests/samesite_cookies.phpt2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/tests/config/config_samesite_cookies.ini b/src/tests/config/config_samesite_cookies.ini
index 9fb5f25..1ca498a 100644
--- a/src/tests/config/config_samesite_cookies.ini
+++ b/src/tests/config/config_samesite_cookies.ini
@@ -1,5 +1,5 @@
1sp.global.secret_key("abcdef").cookie_env_var("REMOTE_ADDR"); 1sp.global.secret_key("abcdef").cookie_env_var("REMOTE_ADDR");
2sp.cookie.name("super_cookie").samesite("Lax"); 2sp.cookie.name("super_cookie").samesite("Lax");
3sp.cookie.name("awful_cookie").samesite("strict").encrypt(); 3sp.cookie.name("awful_cookie").samesite("strict").encrypt();
4sp.cookie.name("nice_cookie").samesite("STRICT"); 4sp.cookie.name("nice_cookie").samesite("STRICT").encrypt();
5sp.auto_cookie_secure.enable(); 5sp.auto_cookie_secure.enable();
diff --git a/src/tests/samesite_cookies.phpt b/src/tests/samesite_cookies.phpt
index 70fe10c..12f3d72 100644
--- a/src/tests/samesite_cookies.phpt
+++ b/src/tests/samesite_cookies.phpt
@@ -16,11 +16,13 @@ EOF;
16<?php 16<?php
17setcookie("super_cookie", "super_value"); 17setcookie("super_cookie", "super_value");
18setcookie("awful_cookie", "awful_value"); 18setcookie("awful_cookie", "awful_value");
19setcookie("not_encrypted", "test_value", 1, "1", "1", false, true);
19setcookie("nice_cookie", "nice_value", 1, "1", "1", true, true); 20setcookie("nice_cookie", "nice_value", 1, "1", "1", true, true);
20 21
21$expected = array( 22$expected = array(
22 'Set-Cookie: super_cookie=super_value; path=; samesite=Lax', 23 'Set-Cookie: super_cookie=super_value; path=; samesite=Lax',
23 'Set-Cookie: awful_cookie=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFyZcYjfEskB0AU0V3%2BvwazcRuU%2Ft6KpcUahvxw%3D; path=; samesite=Strict; HttpOnly', 24 'Set-Cookie: awful_cookie=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFyZcYjfEskB0AU0V3%2BvwazcRuU%2Ft6KpcUahvxw%3D; path=; samesite=Strict; HttpOnly',
25 'Set-Cookie: not_encrypted=test_value; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=1; domain=1; HttpOnly',
24 'Set-Cookie: nice_cookie=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ8ko%2ByA4y%2Bmw5MGBx8fgc3TWOAvhIu%2BfF%2Bx2g%3D%3D; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=1; samesite=Strict; domain=1; secure; HttpOnly', 26 'Set-Cookie: nice_cookie=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ8ko%2ByA4y%2Bmw5MGBx8fgc3TWOAvhIu%2BfF%2Bx2g%3D%3D; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=1; samesite=Strict; domain=1; secure; HttpOnly',
25 ); 27 );
26 28