Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDFViewer / CSP - frame-src object-src blob: #8498

Merged
merged 2 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/bugfix-oc10-pdf-display
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: PDF display issue - Update CSP object-src policy

PDF display is associated with object-src / frame-src policy with blob values.

We allow those for only : 'self' blob:;

https://github.com/owncloud/web/pull/8498
20 changes: 12 additions & 8 deletions packages/web-integration-oc10/lib/Controller/FilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,20 @@ public function getFile(string $path): Response {
$response->setContentSecurityPolicy($csp);
}
if (\strpos($path, "index.html") === 0) {
$csp = new ContentSecurityPolicy();
$csp->allowInlineScript(true);
$csp = $this->applyCSPOpenIDConnect($csp);
$csp = new ContentSecurityPolicy();
$csp->allowInlineScript(true);
$csp = $this->applyCSPOpenIDConnect($csp);

// Required to support PDF Viewer
$csp->addAllowedFrameDomain('\'self\'');
$csp->addAllowedObjectDomain('\'self\' blob:');

// for now we set CSP rules manually, until we have sufficient requirements for a generic solution.
$csp = $this->applyCSPOnlyOffice($csp);
$csp = $this->applyCSPRichDocuments($csp);
// for now we set CSP rules manually, until we have sufficient requirements for a generic solution.
$csp = $this->applyCSPOnlyOffice($csp);
$csp = $this->applyCSPRichDocuments($csp);

$response->setContentSecurityPolicy($csp);
}
$response->setContentSecurityPolicy($csp);
}

return $response;
}
Expand Down