Skip to content

Commit

Permalink
fix(headers): only add Cross-Origin-Opener-Policy and Cross-Origin-Em…
Browse files Browse the repository at this point in the history
…bedder-Policy on richdocuments

Otherwise it's being added to absolutely all requests, creating issues in other apps

Closes #4103

Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld committed Nov 7, 2024
1 parent 055392a commit 6c8edfa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Listener/BeforeTemplateRenderedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
namespace OCA\Richdocuments\Listener;

use OCA\Richdocuments\AppInfo\Application;
use OCA\Richdocuments\Service\CapabilitiesService;
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
use OCP\EventDispatcher\Event;
Expand All @@ -24,7 +25,7 @@ public function handle(Event $event): void {
return;
}

if ($this->capabilitiesService->hasWASMSupport()) {
if ($this->capabilitiesService->hasWASMSupport() && $event->getResponse()->getApp() === Application::APPNAME) {
$event->getResponse()->addHeader('Cross-Origin-Opener-Policy', 'same-origin');
$event->getResponse()->addHeader('Cross-Origin-Embedder-Policy', 'require-corp');
}
Expand Down

0 comments on commit 6c8edfa

Please sign in to comment.