|
|
@@ -382,14 +382,14 @@ class SecurityComponentTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * testValidatePostFormHacking method
|
|
|
+ * testValidatePostFormTampering method
|
|
|
*
|
|
|
* Test that validatePost fails if any of its required fields are missing.
|
|
|
*
|
|
|
* @return void
|
|
|
* @triggers Controller.startup $this->Controller
|
|
|
*/
|
|
|
- public function testValidatePostFormHacking(): void
|
|
|
+ public function testValidatePostFormTampering(): void
|
|
|
{
|
|
|
$event = new Event('Controller.startup', $this->Controller);
|
|
|
$this->Security->startup($event);
|
|
|
@@ -888,6 +888,7 @@ class SecurityComponentTest extends TestCase
|
|
|
]));
|
|
|
Configure::write('debug', false);
|
|
|
$result = $this->validatePost('SecurityException', 'The request has been black-holed');
|
|
|
+ $this->assertFalse($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -928,6 +929,30 @@ class SecurityComponentTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Test that invalid types cause failures.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testValidatePostFailArrayData()
|
|
|
+ {
|
|
|
+ $event = new Event('Controller.startup', $this->Controller);
|
|
|
+ $this->Security->startup($event);
|
|
|
+ $this->Controller->setRequest($this->Controller->getRequest()->withParsedBody([
|
|
|
+ 'Model' => [
|
|
|
+ 'username' => 'mark',
|
|
|
+ 'password' => 'sekret',
|
|
|
+ ],
|
|
|
+ '_Token' => [
|
|
|
+ 'fields' => [],
|
|
|
+ 'unlocked' => '',
|
|
|
+ ],
|
|
|
+ ]));
|
|
|
+ Configure::write('debug', false);
|
|
|
+ $result = $this->validatePost('SecurityException', "'_Token.fields' was invalid.");
|
|
|
+ $this->assertFalse($result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* testValidateHiddenMultipleModel method
|
|
|
*
|
|
|
* @return void
|