Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 2681347

Browse files
authored
Update Csrf.php
The CSRF is a bit naive, assuming that it is receiving a string, and not an array. Most penetration tests start with malformed input, and arrays cause this validator to throw an Array to string conversion error.
1 parent 010084d commit 2681347

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Csrf.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ public function __construct($options = [])
116116
*/
117117
public function isValid($value, $context = null)
118118
{
119-
$this->setValue((string) $value);
119+
if (! is_string($value) ){
120+
return false;
121+
}
122+
123+
$this->setValue($value);
120124

121125
$tokenId = $this->getTokenIdFromHash($value);
122126
$hash = $this->getValidationToken($tokenId);

0 commit comments

Comments
 (0)