Skip to content

Commit 6535e62

Browse files
author
gwoo
committed
merging 1.2
1 parent 94c01ac commit 6535e62

File tree

6 files changed

+39
-9
lines changed

6 files changed

+39
-9
lines changed

cake/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
// +---------------------------------------------------------------------------------------------------+ //
77
///////////////////////////////////////////////////////////////////////////////////////////////////////////
88

9-
1.2.2.8120
9+
1.2.3.8166

cake/config/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
* @lastmodified $Date$
2323
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
2424
*/
25-
return $config['Cake.version'] = '1.2.2.8120';
25+
return $config['Cake.version'] = '1.2.3.8166';
2626
?>

cake/dispatcher.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ function baseUrl() {
344344
return $this->base = $base;
345345
}
346346
if (!$baseUrl) {
347-
$base = dirname(env('PHP_SELF'));
347+
$replace = array('<', '>', '*', '\'', '"');
348+
$base = str_replace($replace, '', dirname(env('PHP_SELF')));
348349

349350
if ($webroot === 'webroot' && $webroot === basename($base)) {
350351
$base = dirname($base);

cake/libs/model/model.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,10 @@ function read($fields = null, $id = null) {
10101010
}
10111011

10121012
if ($id !== null && $id !== false) {
1013-
$this->data = $this->find(array($this->alias . '.' . $this->primaryKey => $id), $fields);
1013+
$this->data = $this->find('first', array(
1014+
'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
1015+
'fields' => $fields
1016+
));
10141017
return $this->data;
10151018
} else {
10161019
return false;

cake/tests/cases/dispatcher.test.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,23 @@ function testHttpMethodOverrides() {
18981898

18991899
unset($_POST['_method']);
19001900
}
1901+
1902+
/**
1903+
* Tests that invalid characters cannot be injected into the application base path.
1904+
*
1905+
* @return void
1906+
*/
1907+
function testBasePathInjection() {
1908+
$self = $_SERVER['PHP_SELF'];
1909+
$_SERVER['PHP_SELF'] = urldecode(
1910+
"/index.php/%22%3E%3Ch1%20onclick=%22alert('xss');%22%3Eheya%3C/h1%3E"
1911+
);
1912+
1913+
$dispatcher =& new Dispatcher();
1914+
$result = $dispatcher->baseUrl();
1915+
$expected = '/index.php/h1 onclick=alert(xss);heya';
1916+
$this->assertEqual($result, $expected);
1917+
}
19011918
/**
19021919
* testEnvironmentDetection method
19031920
*

cake/tests/cases/libs/router.test.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -658,14 +658,23 @@ function testUrlGeneration() {
658658

659659
Router::reload();
660660
Router::setRequestInfo(array(
661-
array('plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'admin_edit', 'pass' =>
662-
array(0 => '6'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' =>
663-
array('url' => 'admin/shows/show_tickets/edit/6')),
664-
array('plugin' => NULL, 'controller' => NULL, 'action' => NULL, 'base' => '', 'here' => '/admin/shows/show_tickets/edit/6', 'webroot' => '/')));
661+
array(
662+
'plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'admin_edit',
663+
'pass' => array('6'), 'prefix' => 'admin', 'admin' => true, 'form' => array(),
664+
'url' => array('url' => 'admin/shows/show_tickets/edit/6')
665+
),
666+
array(
667+
'plugin' => null, 'controller' => null, 'action' => null, 'base' => '',
668+
'here' => '/admin/shows/show_tickets/edit/6', 'webroot' => '/'
669+
)
670+
));
665671

666672
Router::parse('/');
667673

668-
$result = Router::url(array('plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'edit', 'id' => '6', 'admin' => true, 'prefix' => 'admin', ));
674+
$result = Router::url(array(
675+
'plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'edit', 'id' => '6',
676+
'admin' => true, 'prefix' => 'admin'
677+
));
669678
$expected = '/admin/shows/show_tickets/edit/6';
670679
$this->assertEqual($result, $expected);
671680
}

0 commit comments

Comments
 (0)