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

New commits:
commit 1278be1beeb2200c5df89fb3189342491fc42b2d
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Nov 27 09:56:27 2023 +0100
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Mon Mar 11 05:11:48 2024 +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>
    (cherry picked from commit 42109bda9972738b6e7a4448127458c7d24be4dc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164505

diff --git a/sc/source/core/tool/webservicelink.cxx 
b/sc/source/core/tool/webservicelink.cxx
index 12fe4785ebca..a1c307eb8e70 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>
@@ -35,6 +36,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 4e0512a711a6..329a7274b7e7 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2530,6 +2530,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