summaryrefslogtreecommitdiff
path: root/src/tests/encrypt_cookies_invalid_decryption_short_cookie.phpt
diff options
context:
space:
mode:
authorjvoisin2017-12-27 15:43:33 +0100
committerjvoisin2017-12-27 15:43:33 +0100
commit4fafa8ae5a7bcd700f368bbe6016e0b0fb2cc892 (patch)
tree12438ccccb237e3507fb5bd08c43901d7d0bf904 /src/tests/encrypt_cookies_invalid_decryption_short_cookie.phpt
parent60888daa7fb433ca15157256980f8baeb8b698a0 (diff)
Implement simulation mode for cookies (de/en)cryption
This should close #102 This commit can be useful for two use-cases: 1. When deploying Snuffleupagus on big CMS like Magento, and not knowing what cookies are modified via javascript. 2. When deploying Snuffleupagus on big websites: you don't want to disconnect every single user at once. When simulation is enabled, if the decryption fails, a log message is now issued, and the cookie value taken as it (since odds are that it's non-encrypted).
Diffstat (limited to 'src/tests/encrypt_cookies_invalid_decryption_short_cookie.phpt')
-rw-r--r--src/tests/encrypt_cookies_invalid_decryption_short_cookie.phpt24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/encrypt_cookies_invalid_decryption_short_cookie.phpt b/src/tests/encrypt_cookies_invalid_decryption_short_cookie.phpt
new file mode 100644
index 0000000..e5b6bfc
--- /dev/null
+++ b/src/tests/encrypt_cookies_invalid_decryption_short_cookie.phpt
@@ -0,0 +1,24 @@
1--TEST--
2Cookie encryption - invalid decryption in simulation mode with a short cookie
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/config_encrypted_cookies_simulation.ini
7display_errors=1
8display_startup_errors=1
9error_reporting=E_ALL
10--COOKIE--
11super_cookie=AAA;awful_cookie=awful_cookie_value;
12--ENV--
13return <<<EOF
14REMOTE_ADDR=127.0.0.1
15EOF;
16--FILE--
17<?php var_dump($_COOKIE); ?>
18--EXPECT--
19array(2) {
20 ["super_cookie"]=>
21 string(3) "AAA"
22 ["awful_cookie"]=>
23 string(18) "awful_cookie_value"
24}