From dee13501d67ac544c090d68c95c9a9df75f8bf27 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Mon, 27 Nov 2023 09:56:27 +0100 Subject: lok: Block requests to load external references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - currently in LOK case we don't open multiple files in one "environment" - currently it opens import dialog which is synchronous - and that blocks whole app Change-Id: I11c2c7f602ecf1e29b3d6fb2930ce873749bc2ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159984 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161058 Tested-by: Jenkins --- sc/source/core/tool/webservicelink.cxx | 8 ++++++++ sc/source/ui/docshell/externalrefmgr.cxx | 6 ++++++ 2 files changed, 14 insertions(+) (limited to 'sc/source') diff --git a/sc/source/core/tool/webservicelink.cxx b/sc/source/core/tool/webservicelink.cxx index b61907471e54..156048430636 100644 --- a/sc/source/core/tool/webservicelink.cxx +++ b/sc/source/core/tool/webservicelink.cxx @@ -7,6 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include #include #include #include @@ -36,6 +37,13 @@ sfx2::SvBaseLink::UpdateResult ScWebServiceLink::DataChanged(const OUString&, co aResult.clear(); bHasResult = false; + if (comphelper::LibreOfficeKit::isActive()) + { + SAL_WARN("sc.ui", "ScWebServiceLink::DataChanged: blocked access to external file: \"" + << aURL << "\""); + return ERROR_GENERAL; + } + css::uno::Reference xFileAccess = css::ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext()); if (!xFileAccess.is()) diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 24fb7a808e6d..01476aababe0 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -2542,6 +2542,12 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt if (!isFileLoadable(aFile)) return nullptr; + if (comphelper::LibreOfficeKit::isActive()) + { + SAL_WARN( "sc.ui", "ScExternalRefManager::loadSrcDocument: blocked access to external file: \"" << aFile << "\""); + return nullptr; + } + OUString aOptions = pFileData->maFilterOptions; if ( !pFileData->maFilterName.isEmpty() ) rFilter = pFileData->maFilterName; // don't overwrite stored filter with guessed filter -- cgit