Skip to content
Permalink
Browse files

Fixing security vulnerabilities in the test suite runner.

  • Loading branch information...
markstory committed Apr 23, 2010
1 parent 33a3811 commit a08c09ab17e5b3e76eeee753917662a3e3691830
Showing with 14 additions and 5 deletions.
  1. +14 −5 cake/tests/lib/test_manager.php
@@ -69,7 +69,7 @@ public function __construct() {
$this->appTest = true;
}
if (isset($_GET['plugin'])) {
$this->pluginTest = $_GET['plugin'];
$this->pluginTest = htmlentities($_GET['plugin']);
}
}
@@ -127,8 +127,11 @@ public function runAllTests(&$reporter, $testing = false) {
public function runTestCase($testCaseFile, &$reporter, $testing = false) {
$testCaseFileWithPath = $this->_getTestsPath() . DS . $testCaseFile;
if (!file_exists($testCaseFileWithPath)) {
trigger_error(sprintf(__('Test case %s cannot be found', true), $testCaseFile), E_USER_ERROR);
if (!file_exists($testCaseFileWithPath) || strpos($testCaseFileWithPath, '..')) {
trigger_error(
sprintf(__("Test case %s cannot be found", true), htmlentities($testCaseFile)),
E_USER_ERROR
);
return false;
}
@@ -151,8 +154,14 @@ public function runTestCase($testCaseFile, &$reporter, $testing = false) {
public function runGroupTest($groupTestName, &$reporter) {
$filePath = $this->_getTestsPath('groups') . DS . strtolower($groupTestName) . $this->_groupExtension;
if (!file_exists($filePath)) {
trigger_error(sprintf(__('Group test %s cannot be found at %s', true), $groupTestName, $filePath), E_USER_ERROR);
if (!file_exists($filePath) || strpos($testCaseFileWithPath, '..')) {
trigger_error(sprintf(
__("Group test %s cannot be found at %s", true),
htmlentities($groupTestName),
htmlentities($filePath)
),
E_USER_ERROR
);
}
require_once $filePath;

0 comments on commit a08c09a

Please sign in to comment.
You can’t perform that action at this time.