diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-03-11 15:13:59 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-03-11 15:13:59 +0100 |
commit | cf25e6f5694777a73b2c8e5987765d9cc0dc7fe9 (patch) | |
tree | 7bd91649ed3a9fff31373028022d6464c77eb3ec /apps | |
parent | dbade1936206256f55f89c3f865be4046b8fb546 (diff) | |
parent | 48243a2949932f187cb260912b0bebc11389dff5 (diff) | |
download | nextcloud-server-cf25e6f5694777a73b2c8e5987765d9cc0dc7fe9.tar.gz nextcloud-server-cf25e6f5694777a73b2c8e5987765d9cc0dc7fe9.zip |
Merge pull request #14773 from owncloud/allow-iframes-from-self-in-share-view
Allow iframes from same domain in share view
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/controllers/sharecontroller.php | 7 | ||||
-rw-r--r-- | apps/files_sharing/tests/controller/sharecontroller.php | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php index 2e23ac5908e..ebc54265bf0 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -203,7 +203,12 @@ class ShareController extends Controller { $shareTmpl['downloadURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', array('token' => $token)); $shareTmpl['maxSizeAnimateGif'] = $this->config->getSystemValue('max_filesize_animated_gifs_public_sharing', 10); - return new TemplateResponse($this->appName, 'public', $shareTmpl, 'base'); + $csp = new OCP\AppFramework\Http\ContentSecurityPolicy(); + $csp->addAllowedFrameDomain('\'self\''); + $response = new TemplateResponse($this->appName, 'public', $shareTmpl, 'base'); + $response->setContentSecurityPolicy($csp); + + return $response; } /** diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php index 173f606e188..81e60b03cdc 100644 --- a/apps/files_sharing/tests/controller/sharecontroller.php +++ b/apps/files_sharing/tests/controller/sharecontroller.php @@ -159,7 +159,12 @@ class ShareControllerTest extends \Test\TestCase { 'nonHumanFileSize' => 33, 'maxSizeAnimateGif' => 10, ); + + $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); + $csp->addAllowedFrameDomain('\'self\''); $expectedResponse = new TemplateResponse($this->container['AppName'], 'public', $sharedTmplParams, 'base'); + $expectedResponse->setContentSecurityPolicy($csp); + $this->assertEquals($expectedResponse, $response); } |