Skip to content

Commit

Permalink
Merge pull request #2067 from nextcloud/backport/2051/stable23
Browse files Browse the repository at this point in the history
[stable23] 🐛 Fix CSP violation when Nextcloud server has so-called 'service root'
  • Loading branch information
juliusknorr authored Feb 22, 2022
2 parents 5ac0be9 + 3d3904d commit 3473730
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ public function updateCSP() {
if ($publicWopiUrl !== '') {
$policy->addAllowedFrameDomain('\'self\'');
$policy->addAllowedFrameDomain($this->domainOnly($publicWopiUrl));
if (method_exists($policy, 'addAllowedFormActionDomain')) {
$policy->addAllowedFormActionDomain($this->domainOnly($publicWopiUrl));
}
$policy->addAllowedFormActionDomain($this->domainOnly($publicWopiUrl));
}

/**
Expand Down
1 change: 1 addition & 0 deletions lib/Controller/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private function setupPolicy($response) {
$policy = new ContentSecurityPolicy();
$policy->addAllowedFrameDomain($wopiDomain);
$policy->allowInlineScript(true);
$policy->addAllowedFormActionDomain($wopiDomain);
$response->setContentSecurityPolicy($policy);

$featurePolicy = new FeaturePolicy();
Expand Down

0 comments on commit 3473730

Please sign in to comment.