From 6c8edfa27087d6eb07d81c524cb8e78a5bf7cf50 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 7 Nov 2024 11:14:23 +0100 Subject: [PATCH] fix(headers): only add Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy on richdocuments Otherwise it's being added to absolutely all requests, creating issues in other apps Closes #4103 Signed-off-by: Thomas Citharel --- lib/Listener/BeforeTemplateRenderedListener.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Listener/BeforeTemplateRenderedListener.php b/lib/Listener/BeforeTemplateRenderedListener.php index ca20eb9d7a..2df36907b2 100644 --- a/lib/Listener/BeforeTemplateRenderedListener.php +++ b/lib/Listener/BeforeTemplateRenderedListener.php @@ -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; @@ -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'); }