summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-05-10 16:38:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2023-05-10 22:29:02 +0200
commita580a69a1e579755f726ffcd2a31a6f4f42c7100 (patch)
treeaf283ae1b6ce22a0900d3c6c1a41496b3ebc4b94 /sc/source
parentd3c2ae1bb0913bcb2a28b2243e62f38016ddf7b0 (diff)
reinforce the infobar warning when there are both external links...
and WEBSERVICE present. This information is also shown in the "help" in the infobar Change-Id: I1412dc472afba353153b0c91aac1524cefa76aee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151641 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/docshell/docsh4.cxx17
-rw-r--r--sc/source/ui/docshell/documentlinkmgr.cxx18
2 files changed, 34 insertions, 1 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 611d6537456e..1a344af959fd 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -199,8 +199,23 @@ void ScDocShell::ReloadAllLinks()
m_pDocument->UpdateAreaLinks();
}
-IMPL_LINK_NOARG( ScDocShell, ReloadAllLinksHdl, weld::Button&, void )
+IMPL_LINK( ScDocShell, ReloadAllLinksHdl, weld::Button&, rButton, void )
{
+ ScDocument& rDoc = GetDocument();
+ if (rDoc.HasLinkFormulaNeedingCheck() && rDoc.GetDocLinkManager().hasExternalRefLinks())
+ {
+ // If we have WEBSERVICE/Dde link and other external links in the document, it might indicate some
+ // exfiltration attempt, add *another* warning about this on top of the "Security Warning"
+ // shown in the infobar before they got here.
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(&rButton,
+ VclMessageType::Warning, VclButtonsType::YesNo,
+ ScResId(STR_TRUST_DOCUMENT_WARNING)));
+ xQueryBox->set_secondary_text(ScResId(STR_WEBSERVICE_WITH_LINKS_WARNING));
+ xQueryBox->set_default_response(RET_NO);
+ if (xQueryBox->run() != RET_YES)
+ return;
+ }
+
ReloadAllLinks();
ScTabViewShell* pViewSh = GetBestViewShell();
diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx
index 79a86d08b438..0fb89cfa0d18 100644
--- a/sc/source/ui/docshell/documentlinkmgr.cxx
+++ b/sc/source/ui/docshell/documentlinkmgr.cxx
@@ -21,6 +21,7 @@
#include <documentlinkmgr.hxx>
#include <datastream.hxx>
#include <ddelink.hxx>
+#include <externalrefmgr.hxx>
#include <webservicelink.hxx>
#include <strings.hrc>
#include <scresid.hxx>
@@ -153,6 +154,23 @@ bool DocumentLinkManager::hasDdeOrOleOrWebServiceLinks(bool bDde, bool bOle, boo
return false;
}
+bool DocumentLinkManager::hasExternalRefLinks() const
+{
+ sfx2::LinkManager* pMgr = mpImpl->mpLinkManager;
+ if (!pMgr)
+ return false;
+
+ const sfx2::SvBaseLinks& rLinks = pMgr->GetLinks();
+ for (const auto & rLink : rLinks)
+ {
+ sfx2::SvBaseLink* pBase = rLink.get();
+ if (dynamic_cast<ScExternalRefLink*>(pBase))
+ return true;
+ }
+
+ return false;
+}
+
bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(weld::Window* pWin)
{
sfx2::LinkManager* pMgr = mpImpl->mpLinkManager;