-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for invalid regexp in cookie-related features
This should close #105
- Loading branch information
1 parent
aa5d689
commit 3e67900
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/tests/config/config_encrypted_regexp_cookies_bad_regexp.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sp.global.secret_key("abcdef").cookie_env_var("REMOTE_ADDR"); | ||
sp.cookie.name_r("^super_co[a-z+$").encrypt(); | ||
sp.auto_cookie_secure.enable(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Cookie decryption in ipv4 | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
--INI-- | ||
sp.configuration_file={PWD}/config/config_encrypted_regexp_cookies_bad_regexp.ini | ||
error_reporting=1 | ||
--COOKIE-- | ||
super_cookie=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP3gV9YJZL/pUeNAjCKFW0U2ywmf1CwHzwd2pWM=;awful_cookie=awful_cookie_value; | ||
--ENV-- | ||
return <<<EOF | ||
REMOTE_ADDR=127.0.0.1 | ||
HTTP_USER_AGENT=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 Chrome/59.0.3071.109 Safari/537.36 | ||
EOF; | ||
--FILE-- | ||
<?php var_dump($_COOKIE); ?> | ||
--EXPECT-- | ||
array(2) { | ||
["super_cookie"]=> | ||
string(92) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP3gV9YJZL/pUeNAjCKFW0U2ywmf1CwHzwd2pWM=" | ||
["awful_cookie"]=> | ||
string(18) "awful_cookie_value" | ||
} | ||
|
||
Fatal error: [snuffleupagus][config] Failed to compile '^super_co[a-z+$': missing terminating ] for character class on line 2. in Unknown on line 0 | ||
|
||
Fatal error: [snuffleupagus][config] '.name_r()' is expecting a valid regexp, and not '"^super_co[a-z+$"' on line 2 in Unknown on line 0 |