Use a HMAC to sign and validate CSRF tokens, instead of generating random ones and storing them in the session data
* Use a HMAC to sign and validate CSRF tokens, instead of generating random ones and storing them in the session data. Reduces number of writes to sessions table and fixes kanboard issue #4942. * Added missing CSRF check for starting/stopping subtask timers. Co-authored-by: Willemijn Coene <willemijn@irdc.nl>
This commit is contained in:
@@ -20,10 +20,11 @@ class TokenTest extends Base
|
||||
public function testCSRFTokens()
|
||||
{
|
||||
$token = new Token($this->container);
|
||||
$t1 = $token->getCSRFToken();
|
||||
|
||||
$this->assertNotEmpty($t1);
|
||||
$this->assertTrue($token->validateCSRFToken($t1));
|
||||
$this->assertFalse($token->validateCSRFToken($t1));
|
||||
$csrf = $token->getCSRFToken();
|
||||
$this->assertTrue($token->validateCSRFToken($csrf));
|
||||
|
||||
$pcsrf = $token->getReusableCSRFToken();
|
||||
$this->assertTrue($token->validateReusableCSRFToken($pcsrf));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user