Redirect only to absolute URL

We do not want to redirect to other domains using the "?redirect_url=" feature. Please notice, that the ownCloud project does not consider open redirectors as security issue.
This commit is contained in:
Lukas Reschke 2014-09-29 17:07:43 +02:00
parent 6b45cb5416
commit 6e7365fc17
1 changed files with 4 additions and 2 deletions

View File

@ -847,8 +847,10 @@ class OC_Util {
*/ */
public static function getDefaultPageUrl() { public static function getDefaultPageUrl() {
$urlGenerator = \OC::$server->getURLGenerator(); $urlGenerator = \OC::$server->getURLGenerator();
if (isset($_REQUEST['redirect_url'])) { // Deny the redirect if the URL contains a @
$location = urldecode($_REQUEST['redirect_url']); // This prevents unvalidated redirects like ?redirect_url=:user@domain.com
if (isset($_REQUEST['redirect_url']) && strpos($_REQUEST['redirect_url'], '@') === false) {
$location = $urlGenerator->getAbsoluteURL(urldecode($_REQUEST['redirect_url']));
} else { } else {
$defaultPage = OC_Appconfig::getValue('core', 'defaultpage'); $defaultPage = OC_Appconfig::getValue('core', 'defaultpage');
if ($defaultPage) { if ($defaultPage) {