2ceb93
From 3dd024a28a98a9d4b4efc3c7ec6acaa94d2b25fd Mon Sep 17 00:00:00 2001
2ceb93
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
2ceb93
Date: Fri, 7 Jun 2019 14:04:07 +0100
2ceb93
Subject: [PATCH] explictly exclude LibreLogo from XScript usage
2ceb93
2ceb93
Change-Id: I567647f0e2f8b82e4ef2995c673abe82f4564228
2ceb93
Reviewed-on: https://gerrit.libreoffice.org/73708
2ceb93
Tested-by: Jenkins
2ceb93
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2ceb93
---
2ceb93
 sfx2/source/doc/objmisc.cxx | 13 +++++++++++++
2ceb93
 1 file changed, 13 insertions(+)
2ceb93
2ceb93
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
2ceb93
index e245800f2fec..beea5170e44d 100644
2ceb93
--- a/sfx2/source/doc/objmisc.cxx
2ceb93
+++ b/sfx2/source/doc/objmisc.cxx
2ceb93
@@ -1340,6 +1340,16 @@ namespace
2ceb93
     }
2ceb93
 }
2ceb93
 
2ceb93
+namespace {
2ceb93
+
2ceb93
+// don't allow LibreLogo to be used with our mouseover/etc dom-alike events
2ceb93
+bool UnTrustedScript(const OUString& rScriptURL)
2ceb93
+{
2ceb93
+    return rScriptURL.startsWithIgnoreAsciiCase("vnd.sun.star.script:LibreLogo");
2ceb93
+}
2ceb93
+
2ceb93
+}
2ceb93
+
2ceb93
 ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const OUString& _rScriptURL,
2ceb93
     const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const css::uno::Any* pCaller )
2ceb93
 {
2ceb93
@@ -1352,6 +1362,9 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
2ceb93
     if ( bIsDocumentScript && !lcl_isScriptAccessAllowed_nothrow( _rxScriptContext ) )
2ceb93
         return ERRCODE_IO_ACCESSDENIED;
2ceb93
 
2ceb93
+    if ( UnTrustedScript(_rScriptURL) )
2ceb93
+        return ERRCODE_IO_ACCESSDENIED;
2ceb93
+
2ceb93
     bool bCaughtException = false;
2ceb93
     Any aException;
2ceb93
     try
2ceb93
-- 
2ceb93
2.21.0
2ceb93