summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-09-06 10:05:23 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-09-07 08:54:56 +0200
commit125cf1525361c6cd699574f60b4cf12868188568 (patch)
treed0cd68dcac9213a9ee260b3892a1241707fd7914 /svx
parenta4825162cb5a7f7504bb5a912deccdcfbc1084ce (diff)
add referer to ole objects
so we can identify what document is requesting their contents extends: commit 5668e73beb30b95abc6520b7432c54972ca3ab2c Date: Wed Nov 20 14:43:45 2013 +0100 avmedia: Implement "block untrusted referer links" feature See f0a9ca24fd4bf79cac908bf0d6fdb8905dc504db "rhbz#887420 Implement 'block untrusted referer links' feature" for details. This adds some further /*TODO?*/ comments, and one known problem (marked /*TODO!*/) is that movies/sounds are not blocked during a slideshow presentation. to these objects too, namely OLE2Shape and derivatives AppletShape, FrameShape and PluginShape so in paranoid mode we won't load the contents of such objects from documents considered "untrusted". Change-Id: I6d988035d0cd09fd3fade5f6885fe336c95579ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156598 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/shapeimpl.hxx7
-rw-r--r--svx/source/unodraw/unomod.cxx6
-rw-r--r--svx/source/unodraw/unopage.cxx14
-rw-r--r--svx/source/unodraw/unoshap4.cxx38
4 files changed, 37 insertions, 28 deletions
diff --git a/svx/source/unodraw/shapeimpl.hxx b/svx/source/unodraw/shapeimpl.hxx
index 68189814fe6a..ce67e16bb572 100644
--- a/svx/source/unodraw/shapeimpl.hxx
+++ b/svx/source/unodraw/shapeimpl.hxx
@@ -36,7 +36,7 @@ protected:
virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
public:
- explicit SvxPluginShape(SdrObject* pObj);
+ explicit SvxPluginShape(SdrObject* pObj, OUString referer);
virtual ~SvxPluginShape() noexcept override;
virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
@@ -46,6 +46,7 @@ public:
virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
};
+
class SvxAppletShape : public SvxOle2Shape
{
protected:
@@ -54,7 +55,7 @@ protected:
virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
public:
- explicit SvxAppletShape(SdrObject* pObj);
+ explicit SvxAppletShape(SdrObject* pObj, OUString referer);
virtual ~SvxAppletShape() noexcept override;
virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
@@ -76,7 +77,7 @@ protected:
css::uno::Any& rValue) override;
public:
- explicit SvxFrameShape(SdrObject* pObj);
+ explicit SvxFrameShape(SdrObject* pObj, OUString referer);
virtual ~SvxFrameShape() noexcept override;
virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index b36eb09a5caa..4a562caeadad 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -210,7 +210,11 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstanceWi
{
OUString arg;
if ((ServiceSpecifier == "com.sun.star.drawing.GraphicObjectShape"
- || ServiceSpecifier == "com.sun.star.drawing.MediaShape")
+ || ServiceSpecifier == "com.sun.star.drawing.AppletShape"
+ || ServiceSpecifier == "com.sun.star.drawing.FrameShape"
+ || ServiceSpecifier == "com.sun.star.drawing.OLE2Shape"
+ || ServiceSpecifier == "com.sun.star.drawing.MediaShape"
+ || ServiceSpecifier == "com.sun.star.drawing.PluginShape")
&& Arguments.getLength() == 1 && (Arguments[0] >>= arg))
{
return create(ServiceSpecifier, arg);
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index 846e41ae590f..7c8ab3dde951 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -694,13 +694,13 @@ rtl::Reference<SvxShape> SvxDrawPage::CreateShapeByTypeAndInventor( SdrObjKind n
pRet = new SvxGraphicObject( pObj );
break;
case SdrObjKind::OLEPluginFrame:
- pRet = new SvxFrameShape( pObj );
+ pRet = new SvxFrameShape( pObj, referer );
break;
case SdrObjKind::OLE2Applet:
- pRet = new SvxAppletShape( pObj );
+ pRet = new SvxAppletShape( pObj, referer );
break;
case SdrObjKind::OLE2Plugin:
- pRet = new SvxPluginShape( pObj );
+ pRet = new SvxPluginShape( pObj, referer );
break;
case SdrObjKind::OLE2:
{
@@ -728,17 +728,17 @@ rtl::Reference<SvxShape> SvxDrawPage::CreateShapeByTypeAndInventor( SdrObjKind n
if( aPluginClassId == aClassId )
{
- pRet = new SvxPluginShape( pObj );
+ pRet = new SvxPluginShape( pObj, referer );
nType = SdrObjKind::OLE2Plugin;
}
else if( aAppletClassId == aClassId )
{
- pRet = new SvxAppletShape( pObj );
+ pRet = new SvxAppletShape( pObj, referer );
nType = SdrObjKind::OLE2Applet;
}
else if( aIFrameClassId == aClassId )
{
- pRet = new SvxFrameShape( pObj );
+ pRet = new SvxFrameShape( pObj, referer );
nType = SdrObjKind::OLEPluginFrame;
}
}
@@ -748,7 +748,7 @@ rtl::Reference<SvxShape> SvxDrawPage::CreateShapeByTypeAndInventor( SdrObjKind n
if( pRet == nullptr )
{
SvxUnoPropertyMapProvider& rSvxMapProvider = getSvxMapProvider();
- pRet = new SvxOle2Shape( pObj, rSvxMapProvider.GetMap(SVXMAP_OLE2), rSvxMapProvider.GetPropertySet(SVXMAP_OLE2, SdrObject::GetGlobalDrawObjectItemPool()) );
+ pRet = new SvxOle2Shape( pObj, referer, rSvxMapProvider.GetMap(SVXMAP_OLE2), rSvxMapProvider.GetPropertySet(SVXMAP_OLE2, SdrObject::GetGlobalDrawObjectItemPool()) );
}
}
break;
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 02790b767084..1fe494a07d6b 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -64,14 +64,16 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
-SvxOle2Shape::SvxOle2Shape(SdrObject* pObject)
-: SvxShapeText( pObject, getSvxMapProvider().GetMap(SVXMAP_OLE2),
- getSvxMapProvider().GetPropertySet(SVXMAP_OLE2,SdrObject::GetGlobalDrawObjectItemPool()) )
+SvxOle2Shape::SvxOle2Shape(SdrObject* pObject, OUString referer)
+ : SvxShapeText(pObject, getSvxMapProvider().GetMap(SVXMAP_OLE2),
+ getSvxMapProvider().GetPropertySet(SVXMAP_OLE2,SdrObject::GetGlobalDrawObjectItemPool()))
+ , referer_(std::move(referer))
{
}
-SvxOle2Shape::SvxOle2Shape(SdrObject* pObject, o3tl::span<const SfxItemPropertyMapEntry> pPropertyMap, const SvxItemPropertySet* pPropertySet)
-: SvxShapeText( pObject, pPropertyMap, pPropertySet )
+SvxOle2Shape::SvxOle2Shape(SdrObject* pObject, OUString referer, o3tl::span<const SfxItemPropertyMapEntry> pPropertyMap, const SvxItemPropertySet* pPropertySet)
+ : SvxShapeText(pObject, pPropertyMap, pPropertySet)
+ , referer_(std::move(referer))
{
}
@@ -448,16 +450,18 @@ void SvxOle2Shape::createLink( const OUString& aLinkURL )
::comphelper::IEmbeddedHelper* pPersist = GetSdrObject()->getSdrModelFromSdrObject().GetPersist();
- uno::Sequence< beans::PropertyValue > aMediaDescr{ comphelper::makePropertyValue("URL",
- aLinkURL) };
+ uno::Sequence< beans::PropertyValue > aMediaDescr{
+ comphelper::makePropertyValue("URL", aLinkURL),
+ comphelper::makePropertyValue("Referer", referer_)
+ };
uno::Reference< task::XInteractionHandler > xInteraction = pPersist->getInteractionHandler();
if ( xInteraction.is() )
{
- aMediaDescr.realloc( 2 );
+ aMediaDescr.realloc( 3 );
auto pMediaDescr = aMediaDescr.getArray();
- pMediaDescr[1].Name = "InteractionHandler";
- pMediaDescr[1].Value <<= xInteraction;
+ pMediaDescr[2].Name = "InteractionHandler";
+ pMediaDescr[2].Value <<= xInteraction;
}
//TODO/LATER: how to cope with creation failure?!
@@ -558,8 +562,8 @@ OUString SvxOle2Shape::GetAndClearInitialFrameURL()
return OUString();
}
-SvxAppletShape::SvxAppletShape(SdrObject* pObject)
- : SvxOle2Shape( pObject, getSvxMapProvider().GetMap(SVXMAP_APPLET), getSvxMapProvider().GetPropertySet(SVXMAP_APPLET, SdrObject::GetGlobalDrawObjectItemPool()) )
+SvxAppletShape::SvxAppletShape(SdrObject* pObject, OUString referer)
+ : SvxOle2Shape(pObject, std::move(referer), getSvxMapProvider().GetMap(SVXMAP_APPLET), getSvxMapProvider().GetPropertySet(SVXMAP_APPLET, SdrObject::GetGlobalDrawObjectItemPool()))
{
SetShapeType( "com.sun.star.drawing.AppletShape" );
}
@@ -629,8 +633,8 @@ bool SvxAppletShape::getPropertyValueImpl( const OUString& rName, const SfxItemP
}
}
-SvxPluginShape::SvxPluginShape(SdrObject* pObject)
- : SvxOle2Shape( pObject, getSvxMapProvider().GetMap(SVXMAP_PLUGIN), getSvxMapProvider().GetPropertySet(SVXMAP_PLUGIN, SdrObject::GetGlobalDrawObjectItemPool()) )
+SvxPluginShape::SvxPluginShape(SdrObject* pObject, OUString referer)
+ : SvxOle2Shape(pObject, std::move(referer), getSvxMapProvider().GetMap(SVXMAP_PLUGIN), getSvxMapProvider().GetPropertySet(SVXMAP_PLUGIN, SdrObject::GetGlobalDrawObjectItemPool()))
{
SetShapeType( "com.sun.star.drawing.PluginShape" );
}
@@ -700,9 +704,8 @@ bool SvxPluginShape::getPropertyValueImpl( const OUString& rName, const SfxItemP
}
}
-
-SvxFrameShape::SvxFrameShape(SdrObject* pObject)
-: SvxOle2Shape( pObject, getSvxMapProvider().GetMap(SVXMAP_FRAME), getSvxMapProvider().GetPropertySet(SVXMAP_FRAME, SdrObject::GetGlobalDrawObjectItemPool()) )
+SvxFrameShape::SvxFrameShape(SdrObject* pObject, OUString referer)
+ : SvxOle2Shape(pObject, std::move(referer), getSvxMapProvider().GetMap(SVXMAP_FRAME), getSvxMapProvider().GetPropertySet(SVXMAP_FRAME, SdrObject::GetGlobalDrawObjectItemPool()))
{
SetShapeType( "com.sun.star.drawing.FrameShape" );
}
@@ -783,6 +786,7 @@ bool SvxFrameShape::getPropertyValueImpl(const OUString& rName, const SfxItemPro
return SvxOle2Shape::getPropertyValueImpl( rName, pProperty, rValue );
}
}
+
SvxMediaShape::SvxMediaShape(SdrObject* pObj, OUString referer)
: SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_MEDIA), getSvxMapProvider().GetPropertySet(SVXMAP_MEDIA, SdrObject::GetGlobalDrawObjectItemPool()) ),
referer_(std::move(referer))