office-gobmx/svx/source/inc/xmlxtimp.hxx
Stephan Bergmann f0a9ca24fd rhbz#887420 Implement "block untrusted referer links" feature
For now, this checks for a trusted referer (if the BlockUntrustedRefererLinks
configuration prop is set) in utl::MediaDescriptor::impl_openStreamWithURL and
SvxBrushItem::GetGraphicObject.  Checking in additional places will probably be
necessary to block /all/ unwanted communication.  Also, some places marked
/*TODO?*/ currently pass in an empty referer (which is always considered
trusted) and will probably need to be adapted.

Ideally, Referer URIs would never be empty (and consistently use something like
<private:user> for cases where access is explicitly initiated by the user and
should never be blocked), but that's a very daunting task, so start small by
identifying the places that potentially need blocking and adding appropriate
Referer URIs there.  Also, Referer information should always be computed as
freshly as possible from the context in which an access attempt is made, but,
again, always carrying the information from the context all the way to the
relevant functions is a very daunting task, so for now store the information
upon object instantiation in some cases (SvxBrushItem, SdrGrafObj, ...).

The Referer URI (css.document.MediaDescriptor property; SID_REFERER) was already
used to track macro execution, and there is one place in
SfxApplication::OpenDocExec_Impl where opening of hyperlinks (explicitly clicked
by the user) is done that needs the current document's URI as Referer to check
execution of macro URIs but needs an empty (or <private:user>, see above)
Referer to not block non-macro URIs.  Special code has been added there to
handle that.

Change-Id: Iafbdc07a9fe925d9ee580d4f5778448f18f2ebd9
2013-11-14 11:13:25 +01:00

59 lines
2.5 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SVX_SOURCE_INC_XMLXTIMP_HXX
#define INCLUDED_SVX_SOURCE_INC_XMLXTIMP_HXX
#include <xmloff/xmlimp.hxx>
namespace com { namespace sun { namespace star {
namespace uno { template<class X> class Reference; }
namespace uno { class XInterface; }
namespace document { class XGraphicObjectResolver; }
namespace container { class XNameContainer; }
} } }
class SvxXMLXTableImport : public SvXMLImport
{
public:
// #110680#
SvxXMLXTableImport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & rTable,
com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& xGrfResolver);
virtual ~SvxXMLXTableImport() throw ();
static bool load( const OUString &rPath, const OUString &rReferer,
const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XStorage > &xStorage,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xTable,
bool *bOptLoadedFromStorage ) throw();
protected:
virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
private:
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & mrTable;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */