Bug 119507 - macro signature's should not be removed as long as macro source code has not changed
Summary: macro signature's should not be removed as long as macro source code has not ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on: 42316 129311
Blocks: Digital-Signatures Macro
  Show dependency treegraph
 
Reported: 2018-08-26 13:40 UTC by Oliver Brinzing
Modified: 2023-11-06 16:38 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
macro signed template (15.44 KB, application/vnd.oasis.opendocument.text-template)
2018-08-26 13:40 UTC, Oliver Brinzing
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Brinzing 2018-08-26 13:40:11 UTC
Created attachment 144453 [details]
macro signed template

imagine an enterprise environment, where users should work with 
templates (containing macros) and macro security level is set to "High":

steps to reproduce:

- set Macro Security to "High":
  Menu "Tools/Options.../LibreOffice/Security/[Macro Security...]"
- open attached template:
  Menu "File/Templates/Open Template ..."
- check "[x] Always trust macros from this source" and [Enable Macros]

  btw: is there an option to prevent users trusting a signed macro?
       imho it would make sence to have an option to allow only macro's
       signed with preinstalled/validated certificates.

- verify signatures: 
  document (banner below toolbar) and 
  macro (Menu "Tools/Macros/Digital Signature..."
- close template

- open a document from template:
  Menu "File/Open.../macro_signed_template.ott"
- document and macro signature's have been removed.
- but [Run Macro] will still work!
- save "Untitled 1" as "test.odt" and close
- open "test.odt"
- macros execution is disabled now

"repair" test.odt:
- copy "META-INF/macrosignatures.xml" from "macro_signed_template.ott"
  to test.odt's "META-INF" folder.
- open "test.odt"
- [Run Macro] will work again

conclusion:
macro signature's should not be removed as long as macro source code 
has not changed.

problem:
- open "test.odt"
- Menu "File/Tools/Macros/Edit Macro"
- edit macro (for example change msgbox text) *without* saving the document
- [Run Macro] will work!
- save and close
- open "test.odt"
- macro will not work

conclusion:
macro execution should be disabled as soon as macro source code has changed.
user should be warned editing signed macro code.
Comment 1 Drew Jensen 2018-08-26 17:08:13 UTC
Confirm that the behavior is as you describe. Test system Ubuntu 18.04, 
Version: 6.1.1.0.0+
Build ID: 30c178dcb3301527ad92bbd245d1525ab77e314e
Comment 2 Thorsten Behrens (allotropia) 2019-06-26 10:26:29 UTC
Scope of this bug is a bit wider (applies to all documents), but the example is duplicate to bug 42316.
Comment 3 Jan-Marek Glogowski 2019-12-10 18:41:47 UTC
I stumbled over this while looking for a bug like 129311. So I'll just add some update

Finished parts:
* macro signatures should not be removed as long as macro source code has not changed => bug 42316
* prevent users to trust a signed macro with *High* macro security set and locked trusted authors list => bug 129311

This leaves:
* signed macros should be disabled as soon as the source code has been changed (and therefore invalidated the signature)
* user should be warned when editing signed macro code

This bug shows exactly why I don't like a single bug for multiple problems. Maybe someone will remember to close this bug at some point, if finally all parts are fixed, maybe not :-( More bugs will be opened eventually, if some additional part can be / is fixed.

I also removed the bug 107882 from the "see also" list. I don't see any connection between some Cyrillic StarBasic editor problems and this bug.
Comment 4 QA Administrators 2021-12-10 04:22:55 UTC Comment hidden (obsolete)
Comment 5 Timur 2023-11-06 16:38:41 UTC
Fixed in 7.2 resulted in the following commit:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=1dc71daf7fa7204a98c75dac680af664ab9c8edb

author		Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>	2021-01-18 15:24:48 +0100
committer	Thorsten Behrens <thorsten.behrens@allotropia.de>	2021-01-28 12:45:30 +0100

Improve macro checks

Missing was bug 158090 , with that I set this as Fixed.