Skip to content
This repository
Browse code

merging 1.2

  • Loading branch information...
commit 6535e6225c5961781699f6afedba8b438045e083 1 parent 94c01ac
authored May 04, 2009
2  cake/VERSION.txt
@@ -6,4 +6,4 @@
6 6
 // +---------------------------------------------------------------------------------------------------+ //
7 7
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
8 8
 
9  
-1.2.2.8120
  9
+1.2.3.8166
2  cake/config/config.php
@@ -22,5 +22,5 @@
22 22
  * @lastmodified  $Date$
23 23
  * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
24 24
  */
25  
-return $config['Cake.version'] = '1.2.2.8120';
  25
+return $config['Cake.version'] = '1.2.3.8166';
26 26
 ?>
3  cake/dispatcher.php
@@ -344,7 +344,8 @@ function baseUrl() {
344 344
 			return $this->base = $base;
345 345
 		}
346 346
 		if (!$baseUrl) {
347  
-			$base = dirname(env('PHP_SELF'));
  347
+			$replace = array('<', '>', '*', '\'', '"');
  348
+			$base = str_replace($replace, '', dirname(env('PHP_SELF')));
348 349
 
349 350
 			if ($webroot === 'webroot' && $webroot === basename($base)) {
350 351
 				$base = dirname($base);
5  cake/libs/model/model.php
@@ -1010,7 +1010,10 @@ function read($fields = null, $id = null) {
1010 1010
 		}
1011 1011
 
1012 1012
 		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
+			));
1014 1017
 			return $this->data;
1015 1018
 		} else {
1016 1019
 			return false;
17  cake/tests/cases/dispatcher.test.php
@@ -1898,6 +1898,23 @@ function testHttpMethodOverrides() {
1898 1898
 
1899 1899
 		unset($_POST['_method']);
1900 1900
 	}
  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
+	}
1901 1918
 /**
1902 1919
  * testEnvironmentDetection method
1903 1920
  *
19  cake/tests/cases/libs/router.test.php
@@ -658,14 +658,23 @@ function testUrlGeneration() {
658 658
 
659 659
 		Router::reload();
660 660
 		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
+		));
665 671
 
666 672
 		Router::parse('/');
667 673
 
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
+		));
669 678
 		$expected = '/admin/shows/show_tickets/edit/6';
670 679
 		$this->assertEqual($result, $expected);
671 680
 	}

0 notes on commit 6535e62

Please sign in to comment.
Something went wrong with that request. Please try again.