diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-10-23 16:42:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-23 16:42:24 +0200 |
commit | 39338aaa676168b0a53c3a1f6d5363569f303361 (patch) | |
tree | 4c7a779bbd3a1203ce1caa02b98e49f2955cfbb1 /tests | |
parent | ae94c5a94cd0d2d9ff6b759fbc201eafdc50ba46 (diff) | |
parent | 579822b6a5639ee608e11ed23760d481a4a78f4b (diff) | |
download | nextcloud-server-39338aaa676168b0a53c3a1f6d5363569f303361.tar.gz nextcloud-server-39338aaa676168b0a53c3a1f6d5363569f303361.zip |
Merge pull request #11914 from nextcloud/csp/report-uri
Add report-uri to CSP
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php index 7c30df730d3..7e86903892f 100644 --- a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php @@ -451,4 +451,19 @@ class EmptyContentSecurityPolicyTest extends \Test\TestCase { $this->contentSecurityPolicy->addAllowedScriptDomain("'self'"); $this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy()); } + + public function testGetPolicyWithReportUri() { + $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';report-uri https://my-report-uri.com"; + + $this->contentSecurityPolicy->addReportTo("https://my-report-uri.com"); + $this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy()); + } + + public function testGetPolicyWithMultipleReportUri() { + $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';report-uri https://my-report-uri.com https://my-other-report-uri.com"; + + $this->contentSecurityPolicy->addReportTo("https://my-report-uri.com"); + $this->contentSecurityPolicy->addReportTo("https://my-other-report-uri.com"); + $this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy()); + } } |