sc/source/core/tool/webservicelink.cxx   |    8 ++++++++
 sc/source/ui/docshell/externalrefmgr.cxx |    6 ++++++
 2 files changed, 14 insertions(+)

New commits:
commit dee13501d67ac544c090d68c95c9a9df75f8bf27
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Nov 27 09:56:27 2023 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Wed Dec 20 16:00:44 2023 +0100

    lok: Block requests to load external references
    
    - 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 <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161058
    Tested-by: Jenkins

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 <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <sfx2/linkmgr.hxx>
 #include <sfx2/bindings.hxx>
@@ -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<css::ucb::XSimpleFileAccess3> 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

Reply via email to