Merge pull request #20905 from owncloud/allow-framing-itself

Allow framing 'self'
This commit is contained in:
Thomas Müller 2015-12-02 21:55:12 +01:00
commit e1bf50edd2
2 changed files with 10 additions and 1 deletions

View File

@ -23,6 +23,7 @@ namespace OCA\Files\Controller;
use OC\AppFramework\Http\Request; use OC\AppFramework\Http\Request;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N; use OCP\IL10N;
@ -215,10 +216,15 @@ class ViewController extends Controller {
$params['appContents'] = $contentItems; $params['appContents'] = $contentItems;
$this->navigationManager->setActiveEntry('files_index'); $this->navigationManager->setActiveEntry('files_index');
return new TemplateResponse( $response = new TemplateResponse(
$this->appName, $this->appName,
'index', 'index',
$params $params
); );
$policy = new ContentSecurityPolicy();
$policy->addAllowedFrameDomain('\'self\'');
$response->setContentSecurityPolicy($policy);
return $response;
} }
} }

View File

@ -245,6 +245,9 @@ class ViewControllerTest extends TestCase {
], ],
] ]
); );
$policy = new Http\ContentSecurityPolicy();
$policy->addAllowedFrameDomain('\'self\'');
$expected->setContentSecurityPolicy($policy);
$this->assertEquals($expected, $this->viewController->index('MyDir', 'MyView')); $this->assertEquals($expected, $this->viewController->index('MyDir', 'MyView'));
} }
} }