Skip to content

Commit

Permalink
Merge pull request #913 from owncloud/fix-csp
Browse files Browse the repository at this point in the history
fix: replace marketplace storage urls in csp
  • Loading branch information
jnweiger authored Feb 16, 2022
2 parents 38e2052 + f0d03bb commit bd3b229
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
Expand Down Expand Up @@ -45,9 +46,9 @@ public function index() {
$templateResponse = new TemplateResponse($this->appName, 'index', []);
$policy = new ContentSecurityPolicy();
// live storage
$policy->addAllowedImageDomain('https://storage.marketplace.owncloud.com');
$policy->addAllowedImageDomain('https://marketplace-storage.owncloud.com');
// staging - for internal testing
$policy->addAllowedImageDomain('https://marketplace-storage.int.owncloud.com');
$policy->addAllowedImageDomain('https://marketplace-storage.staging.owncloud.services');
// local dev storage
$policy->addAllowedImageDomain('http://minio:9000');
$templateResponse->setContentSecurityPolicy($policy);
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/PageControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public function testIndex() {
$response = $this->controller->index();

$policy = new \OCP\AppFramework\Http\ContentSecurityPolicy();
$policy->addAllowedImageDomain('https://storage.marketplace.owncloud.com');
$policy->addAllowedImageDomain('https://marketplace-storage.int.owncloud.com');
$policy->addAllowedImageDomain('https://marketplace-storage.owncloud.com');
$policy->addAllowedImageDomain('https://marketplace-storage.staging.owncloud.services');
$policy->addAllowedImageDomain('http://minio:9000');
$this->assertEquals($policy, $response->getContentSecurityPolicy());

Expand All @@ -36,8 +36,8 @@ public function testIndexHash() {
$response = $this->controller->indexHash();

$policy = new \OCP\AppFramework\Http\ContentSecurityPolicy();
$policy->addAllowedImageDomain('https://storage.marketplace.owncloud.com');
$policy->addAllowedImageDomain('https://marketplace-storage.int.owncloud.com');
$policy->addAllowedImageDomain('https://marketplace-storage.owncloud.com');
$policy->addAllowedImageDomain('https://marketplace-storage.staging.owncloud.services');
$policy->addAllowedImageDomain('http://minio:9000');
$this->assertEquals($policy, $response->getContentSecurityPolicy());

Expand Down

0 comments on commit bd3b229

Please sign in to comment.