Skip to content

Commit

Permalink
Fixed ViewAction::resolveViewName() not to accept /../ and /./
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark authored and cebe committed Jul 11, 2015
1 parent cf0541f commit 4e3b82b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion framework/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Yii Framework 2 Change Log
==========================


2.0.5
-----

Bug #9070 (CVE-2015-5467): Fixed `ViewAction::resolveViewName()` not to accept `/../` and `/./` (thejahweh, samdark)

2.0.4 May 10, 2015
------------------

Expand Down Expand Up @@ -41,7 +47,7 @@ Yii Framework 2 Change Log
- Bug #8273: Fixed `yii\widgets\FragmentCache` when `enabled` is false (nkovacs)
- Bug #8291: Fixed numeric keys in $_GET transformed to 0-based, if 'pretty URL' enabled (quantum13, klimov-paul)
- Bug #5053: DateValidator is now more robust against different timezone settings (cebe)
- Bug (CVE-2015-3397): Added `Json::htmlEncode()` to support safer JSON data encoding in HTML code (samdark, Tomasz Tokarski)
- Bug (CVE-2015-3397): Added `Json::htmlEncode()` to support safer JSON data encoding in HTML code (samdark, Wojciech Janusz, Tomasz Tokarski)
- Enh #1468: Added ability to specify hints for model attributes via `attributeHints()` method (klimov-paul)
- Enh #3376: Added `yii\validators\EachValidator`, which allows validation of the array attributes (klimov-paul)
- Enh #5053: Added possibility to specify a format and time zone for the `timestampAttribute` of date validator making it fully usable for validating complete timestamps (cebe)
Expand Down
4 changes: 2 additions & 2 deletions framework/web/ViewAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ protected function resolveViewName()
{
$viewName = Yii::$app->request->get($this->viewParam, $this->defaultView);

if (!is_string($viewName) || !preg_match('/^\w[\w\/\-\.]*$/', $viewName)) {
if (!is_string($viewName) || !preg_match('~^\w(?:(?!\/\.{0,2}\/)[\w\/\-\.])*$~', $viewName)) {
if (YII_DEBUG) {
throw new NotFoundHttpException("The requested view \"$viewName\" must start with a word character and can contain only word characters, forward slashes, dots and dashes.");
throw new NotFoundHttpException("The requested view \"$viewName\" must start with a word character, must not contain /../ or /./, can contain only word characters, forward slashes, dots and dashes.");
} else {
throw new NotFoundHttpException(Yii::t('yii', 'The requested view "{name}" was not found.', ['name' => $viewName]));
}
Expand Down

0 comments on commit 4e3b82b

Please sign in to comment.