tdf#105566 Show InfoBar when signature is invalid
gpg4libre Change-Id: I272ac155889e25b9af91ff723a014588a65b045a Reviewed-on: https://gerrit.libreoffice.org/33737 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
parent
95db32acab
commit
2dff5e856a
@ -1335,11 +1335,6 @@ bool ODatabaseModelImpl::hasTrustedScriptingSignature( bool /*bAllowUIToAddAutho
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ODatabaseModelImpl::showBrokenSignatureWarning( const Reference< XInteractionHandler >& /*_rxInteraction*/ ) const
|
|
||||||
{
|
|
||||||
OSL_FAIL( "ODatabaseModelImpl::showBrokenSignatureWarning: signatures can't be broken - we do not support them!" );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ODatabaseModelImpl::storageIsModified()
|
void ODatabaseModelImpl::storageIsModified()
|
||||||
{
|
{
|
||||||
setModified( true );
|
setModified( true );
|
||||||
|
@ -467,7 +467,6 @@ public:
|
|||||||
virtual css::uno::Reference< css::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const override;
|
virtual css::uno::Reference< css::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const override;
|
||||||
virtual SignatureState getScriptingSignatureState() override;
|
virtual SignatureState getScriptingSignatureState() override;
|
||||||
virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override;
|
virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override;
|
||||||
virtual void showBrokenSignatureWarning( const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction ) const override;
|
|
||||||
|
|
||||||
// IModifiableDocument
|
// IModifiableDocument
|
||||||
virtual void storageIsModified() override;
|
virtual void storageIsModified() override;
|
||||||
|
@ -149,24 +149,6 @@ namespace sfx2
|
|||||||
virtual bool
|
virtual bool
|
||||||
hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) = 0;
|
hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) = 0;
|
||||||
|
|
||||||
/** shows a warning that the document's signature is broken
|
|
||||||
|
|
||||||
Here, a similar note applies as to getScriptingSignatureState: This method doesn't
|
|
||||||
really belong here. It's just there because SfxObjectShell_Impl::bSignatureErrorIsShown
|
|
||||||
is not accessible where the method is called.
|
|
||||||
So, once the signature handling has been oursourced from SfxObjectShell/_Impl, so it
|
|
||||||
is re-usable in non-SFX contexts as well, this method here is also unneeded, probably.
|
|
||||||
|
|
||||||
@param _rxInteraction
|
|
||||||
the interaction handler to use for showing the warning. It is exactly the same
|
|
||||||
as passed to DocumentMacroMode::adjustMacroMode, so it is <NULL/> if and
|
|
||||||
only if the instance passed to that method was <NULL/>.
|
|
||||||
*/
|
|
||||||
virtual void
|
|
||||||
showBrokenSignatureWarning(
|
|
||||||
const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction
|
|
||||||
) const = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~IMacroDocumentAccess() {}
|
~IMacroDocumentAccess() {}
|
||||||
};
|
};
|
||||||
|
@ -684,7 +684,7 @@ public:
|
|||||||
SAL_DLLPRIVATE void InitOwnModel_Impl();
|
SAL_DLLPRIVATE void InitOwnModel_Impl();
|
||||||
SAL_DLLPRIVATE void BreakMacroSign_Impl( bool bBreakMacroSing );
|
SAL_DLLPRIVATE void BreakMacroSign_Impl( bool bBreakMacroSing );
|
||||||
SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
|
SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
|
||||||
SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler );
|
SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl();
|
||||||
SAL_DLLPRIVATE static SignatureState ImplCheckSignaturesInformation(
|
SAL_DLLPRIVATE static SignatureState ImplCheckSignaturesInformation(
|
||||||
const css::uno::Sequence< css::security::DocumentSignatureInformation >& aInfos );
|
const css::uno::Sequence< css::security::DocumentSignatureInformation >& aInfos );
|
||||||
SAL_DLLPRIVATE void CheckEncryption_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler );
|
SAL_DLLPRIVATE void CheckEncryption_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler );
|
||||||
|
@ -120,6 +120,8 @@
|
|||||||
#define STR_CLASSIFIED_EXPORT_CONTROL (RID_SFX_START+136)
|
#define STR_CLASSIFIED_EXPORT_CONTROL (RID_SFX_START+136)
|
||||||
#define STR_READONLY_SIGN (RID_SFX_START+137)
|
#define STR_READONLY_SIGN (RID_SFX_START+137)
|
||||||
#define STR_READONLY_PDF (RID_SFX_START+138)
|
#define STR_READONLY_PDF (RID_SFX_START+138)
|
||||||
|
#define STR_SIGNATURE_BROKEN (RID_SFX_START+139)
|
||||||
|
#define STR_SIGNATURE_SHOW (RID_SFX_START+140)
|
||||||
#define STR_ACCTITLE_PRODUCTIVITYTOOLS (RID_SFX_START+157)
|
#define STR_ACCTITLE_PRODUCTIVITYTOOLS (RID_SFX_START+157)
|
||||||
|
|
||||||
#define SFX_THUMBNAIL_TEXT (RID_SFX_START+158)
|
#define SFX_THUMBNAIL_TEXT (RID_SFX_START+158)
|
||||||
|
@ -72,7 +72,6 @@
|
|||||||
#define ERRCODE_SFX_CANTCREATEBACKUP (ERRCODE_AREA_SFX | ERRCODE_CLASS_CREATE | 50)
|
#define ERRCODE_SFX_CANTCREATEBACKUP (ERRCODE_AREA_SFX | ERRCODE_CLASS_CREATE | 50)
|
||||||
#define ERRCODE_SFX_MACROS_SUPPORT_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 51)
|
#define ERRCODE_SFX_MACROS_SUPPORT_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 51)
|
||||||
#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 52)
|
#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 52)
|
||||||
#define ERRCODE_SFX_BROKENSIGNATURE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 53)
|
|
||||||
#define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 54)
|
#define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 54)
|
||||||
#define ERRCODE_SFX_INCOMPLETE_ENCRYPTION (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 55)
|
#define ERRCODE_SFX_INCOMPLETE_ENCRYPTION (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 55)
|
||||||
#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED_MAC (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 56)
|
#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED_MAC (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 56)
|
||||||
|
@ -230,10 +230,6 @@ namespace sfx2
|
|||||||
SignatureState nSignatureState = m_xData->m_rDocumentAccess.getScriptingSignatureState();
|
SignatureState nSignatureState = m_xData->m_rDocumentAccess.getScriptingSignatureState();
|
||||||
if ( nSignatureState == SignatureState::BROKEN )
|
if ( nSignatureState == SignatureState::BROKEN )
|
||||||
{
|
{
|
||||||
// the signature is broken, no macro execution
|
|
||||||
if ( nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN )
|
|
||||||
m_xData->m_rDocumentAccess.showBrokenSignatureWarning( rxInteraction );
|
|
||||||
|
|
||||||
return disallowMacroExecution();
|
return disallowMacroExecution();
|
||||||
}
|
}
|
||||||
else if ( bHasTrustedMacroSignature )
|
else if ( bHasTrustedMacroSignature )
|
||||||
|
@ -964,7 +964,7 @@ void SfxObjectShell::CheckSecurityOnLoading_Impl()
|
|||||||
xInteraction = GetMedium()->GetInteractionHandler();
|
xInteraction = GetMedium()->GetInteractionHandler();
|
||||||
|
|
||||||
// check if there is a broken signature...
|
// check if there is a broken signature...
|
||||||
CheckForBrokenDocSignatures_Impl( xInteraction );
|
CheckForBrokenDocSignatures_Impl();
|
||||||
|
|
||||||
CheckEncryption_Impl( xInteraction );
|
CheckEncryption_Impl( xInteraction );
|
||||||
|
|
||||||
@ -1012,15 +1012,13 @@ void SfxObjectShell::CheckEncryption_Impl( const uno::Reference< task::XInteract
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SfxObjectShell::CheckForBrokenDocSignatures_Impl( const uno::Reference< task::XInteractionHandler >& xHandler )
|
void SfxObjectShell::CheckForBrokenDocSignatures_Impl()
|
||||||
{
|
{
|
||||||
SignatureState nSignatureState = GetDocumentSignatureState();
|
SignatureState nSignatureState = GetDocumentSignatureState();
|
||||||
bool bSignatureBroken = ( nSignatureState == SignatureState::BROKEN );
|
bool bSignatureBroken = ( nSignatureState == SignatureState::BROKEN );
|
||||||
if ( !bSignatureBroken )
|
if ( !bSignatureBroken )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pImpl->showBrokenSignatureWarning( xHandler );
|
|
||||||
|
|
||||||
// broken signatures imply no macro execution at all
|
// broken signatures imply no macro execution at all
|
||||||
pImpl->aMacroMode.disallowMacroExecution();
|
pImpl->aMacroMode.disallowMacroExecution();
|
||||||
}
|
}
|
||||||
@ -1610,7 +1608,7 @@ bool SfxObjectShell::AdjustMacroMode()
|
|||||||
if ( pMedium )
|
if ( pMedium )
|
||||||
xInteraction = pMedium->GetInteractionHandler();
|
xInteraction = pMedium->GetInteractionHandler();
|
||||||
|
|
||||||
CheckForBrokenDocSignatures_Impl( xInteraction );
|
CheckForBrokenDocSignatures_Impl();
|
||||||
|
|
||||||
CheckEncryption_Impl( xInteraction );
|
CheckEncryption_Impl( xInteraction );
|
||||||
|
|
||||||
@ -1852,15 +1850,6 @@ bool SfxObjectShell_Impl::hasTrustedScriptingSignature( bool bAllowUIToAddAuthor
|
|||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SfxObjectShell_Impl::showBrokenSignatureWarning( const uno::Reference< task::XInteractionHandler >& _rxInteraction ) const
|
|
||||||
{
|
|
||||||
if ( !bSignatureErrorIsShown )
|
|
||||||
{
|
|
||||||
SfxObjectShell::UseInteractionToHandleError( _rxInteraction, ERRCODE_SFX_BROKENSIGNATURE );
|
|
||||||
const_cast< SfxObjectShell_Impl* >( this )->bSignatureErrorIsShown = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SfxObjectShell::AddLog( const OUString& aMessage )
|
void SfxObjectShell::AddLog( const OUString& aMessage )
|
||||||
{
|
{
|
||||||
if ( !pImpl->m_xLogRing.is() )
|
if ( !pImpl->m_xLogRing.is() )
|
||||||
|
@ -152,7 +152,6 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
|
|||||||
virtual SignatureState getScriptingSignatureState() override;
|
virtual SignatureState getScriptingSignatureState() override;
|
||||||
|
|
||||||
virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override;
|
virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override;
|
||||||
virtual void showBrokenSignatureWarning( const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction ) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,4 +140,14 @@ String STR_READONLY_SIGN
|
|||||||
Text[ en-US ] = "Sign Document";
|
Text[ en-US ] = "Sign Document";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
String STR_SIGNATURE_BROKEN
|
||||||
|
{
|
||||||
|
Text[ en-US ] = "Document has an invalid signature.";
|
||||||
|
};
|
||||||
|
|
||||||
|
String STR_SIGNATURE_SHOW
|
||||||
|
{
|
||||||
|
Text[ en-US ] = "Show signatures";
|
||||||
|
};
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@ -1178,6 +1178,18 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
|
|||||||
SfxBindings& rBind = GetBindings();
|
SfxBindings& rBind = GetBindings();
|
||||||
rBind.Invalidate( SID_RELOAD );
|
rBind.Invalidate( SID_RELOAD );
|
||||||
rBind.Invalidate( SID_EDITDOC );
|
rBind.Invalidate( SID_EDITDOC );
|
||||||
|
|
||||||
|
SignatureState nSignatureState = GetObjectShell()->GetDocumentSignatureState();
|
||||||
|
if (nSignatureState == SignatureState::BROKEN) {
|
||||||
|
basegfx::BColor aBackgroundColor = basegfx::BColor(0.5, 0.0, 0.0);
|
||||||
|
auto pInfoBar = AppendInfoBar("signature", SfxResId(STR_SIGNATURE_BROKEN), &aBackgroundColor);
|
||||||
|
VclPtrInstance<PushButton> xBtn(&GetWindow());
|
||||||
|
xBtn->SetText(SfxResId(STR_SIGNATURE_SHOW));
|
||||||
|
xBtn->SetSizePixel(xBtn->GetOptimalSize());
|
||||||
|
xBtn->SetClickHdl(LINK(this, SfxViewFrame, SignDocumentHandler));
|
||||||
|
pInfoBar->addButton(xBtn);
|
||||||
|
}
|
||||||
|
|
||||||
const SfxViewShell *pVSh;
|
const SfxViewShell *pVSh;
|
||||||
const SfxShell *pFSh;
|
const SfxShell *pFSh;
|
||||||
if ( !m_xObjSh->IsReadOnly() ||
|
if ( !m_xObjSh->IsReadOnly() ||
|
||||||
|
@ -467,10 +467,6 @@ Resource RID_ERRHDL
|
|||||||
{
|
{
|
||||||
Text [ en-US ] = "This document contains macros.\n\nMacros may contain viruses. Execution of macros is disabled due to the current macro security setting in Tools - Options - %PRODUCTNAME - Security.\n\nTherefore, some functionality may not be available." ;
|
Text [ en-US ] = "This document contains macros.\n\nMacros may contain viruses. Execution of macros is disabled due to the current macro security setting in Tools - Options - %PRODUCTNAME - Security.\n\nTherefore, some functionality may not be available." ;
|
||||||
};
|
};
|
||||||
String ERRCODE_SFX_BROKENSIGNATURE
|
|
||||||
{
|
|
||||||
Text [ en-US ] = "The digitally signed document content and/or macros do not match the current document signature.\n\nThis could be the result of document manipulation or of structural document damage due to data transmission.\n\nWe recommend that you do not trust the content of the current document.\nExecution of macros is disabled for this document.\n " ;
|
|
||||||
};
|
|
||||||
String ERRCODE_SFX_INCOMPLETE_ENCRYPTION
|
String ERRCODE_SFX_INCOMPLETE_ENCRYPTION
|
||||||
{
|
{
|
||||||
Text [ en-US ] = "The encrypted document contains unexpected non-encrypted streams.\n\nThis could be the result of document manipulation.\n\nWe recommend that you do not trust the content of the current document.\nExecution of macros is disabled for this document.\n " ;
|
Text [ en-US ] = "The encrypted document contains unexpected non-encrypted streams.\n\nThis could be the result of document manipulation.\n\nWe recommend that you do not trust the content of the current document.\nExecution of macros is disabled for this document.\n " ;
|
||||||
|
@ -1126,8 +1126,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
|
|||||||
ErrCode nError = static_cast< ErrCode >(nErrorCode);
|
ErrCode nError = static_cast< ErrCode >(nErrorCode);
|
||||||
bool bWarning = !ERRCODE_TOERROR(nError);
|
bool bWarning = !ERRCODE_TOERROR(nError);
|
||||||
|
|
||||||
if ( nError == ERRCODE_SFX_BROKENSIGNATURE
|
if ( nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
|
||||||
|| nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
|
|
||||||
{
|
{
|
||||||
// the security warning box needs a special title
|
// the security warning box needs a special title
|
||||||
OUString aErrorString;
|
OUString aErrorString;
|
||||||
@ -1137,11 +1136,8 @@ UUIInteractionHelper::handleGenericErrorRequest(
|
|||||||
ResMgr::CreateResMgr( "uui" ) );
|
ResMgr::CreateResMgr( "uui" ) );
|
||||||
OUString aTitle( utl::ConfigManager::getProductName() );
|
OUString aTitle( utl::ConfigManager::getProductName() );
|
||||||
|
|
||||||
OUString aErrTitle
|
OUString aErrTitle = ResId( STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE,
|
||||||
= ResId( nError == ERRCODE_SFX_BROKENSIGNATURE
|
*xManager.get() ).toString();
|
||||||
? STR_WARNING_BROKENSIGNATURE_TITLE
|
|
||||||
: STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE,
|
|
||||||
*xManager.get() ).toString();
|
|
||||||
|
|
||||||
if ( !aTitle.isEmpty() && !aErrTitle.isEmpty() )
|
if ( !aTitle.isEmpty() && !aErrTitle.isEmpty() )
|
||||||
aTitle += " - " ;
|
aTitle += " - " ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user