File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1313use function is_array ;
1414use function is_int ;
1515use function is_string ;
16+ use function strlen ;
1617
1718/**
1819 * This class provides a layer to persist transient auth data using cookies.
@@ -39,6 +40,11 @@ final class CookieStore implements StoreInterface
3940 */
4041 public const VAL_CRYPTO_ALGO = 'aes-128-gcm ' ;
4142
43+ /**
44+ * @var int
45+ */
46+ public const VAL_CRYPTO_TAG_LENGTH_BYTES = 16 ;
47+
4248 /**
4349 * When true, CookieStore will not setState() itself. You will need manually call the method to persist state to storage.
4450 */
@@ -123,7 +129,7 @@ public function decrypt(
123129 $ iv = base64_decode ($ data ['iv ' ], true );
124130 $ tag = base64_decode ($ data ['tag ' ], true );
125131
126- if (! is_string ($ iv ) || ! is_string ($ tag )) {
132+ if (! is_string ($ iv ) || ! is_string ($ tag ) || self :: VAL_CRYPTO_TAG_LENGTH_BYTES !== strlen ( $ tag ) ) {
127133 return null ;
128134 }
129135
You can’t perform that action at this time.
0 commit comments