Bug 168062 - PDF Hybrid export, empty document is reopened by Writer if the "Set permission" password is set
Summary: PDF Hybrid export, empty document is reopened by Writer if the "Set permissio...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
25.8.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Password-Protected
  Show dependency treegraph
 
Reported: 2025-08-22 14:27 UTC by grofaty
Modified: 2025-09-29 00:33 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description grofaty 2025-08-22 14:27:51 UTC
Description:
In export to PDF if "Set permission password" is set then when exported document is opened and correct password entered, empty document is displayed instead of text at export time.

Steps to Reproduce:
1. Open LibreOffice Writer.
2. Type: test
3. File | Export As | Export as PDF
4. General tab set General | PDF Version to PDF 2.0.
5. General tab check "Hybrid PDF (embed ODF file)"
6. Security tab | Set Password button.
7. "Set open password" set to some password and the same for "Confirm" field.
8. "Set permission password" and set some password and the same for "Confirm" field and OK button.
9. Export button set some file name and Export button.
10. Close down ODF document and don't save it.
11. Open exported PDF file.
12. Enter Password dialog appears. Type in password and OK.

Actual Results:
Empty document appears.

Expected Results:
I except to get text from step 2 displayed.


Reproducible: Always


User Profile Reset: No

Additional Info:
Additionally 1:
I have opened Firefox and File | Open and point to pdf file, typed in password and document is correctly displayed.

Additionally 2:
Repeat the test, but skip step 8 and everything works fine in step 13 text is displayed as expected.

Help | About:
==========================
Version: 25.8.0.4 (X86_64) / LibreOffice Community
Build ID: 48f00303701489684e67c38c28aff00cd5929e67
CPU threads: 16; OS: Linux 6.14; UI render: default; VCL: gtk3
Locale: sl-SI (en_US.UTF-8); UI: en-US
Flatpak
Calc: threaded
Comment 1 Saburo 2025-09-27 08:32:30 UTC
confirmed with bibisect-win64-26.2master
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 8ea8e254a3151f5390f3a10ff156fcaf8e7c5d5c
CPU threads: 12; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win
Locale: ja-JP (ja_JP); UI: en-US
Calc: CL threaded

and in 
Version: 25.8.1.1 (X86_64)
Build ID: 54047653041915e595ad4e45cccea684809c77b5
CPU threads: 12; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: CL threaded

also PDF 1.7
Comment 2 V Stuart Foote 2025-09-27 11:35:00 UTC
Note: This is for the LO reopening into Writer of our Hybrid PDF

I do set a different pw for the Open and the Permission (to allow opening only or with permission setting allowed).

Use of either pw opens the source ODF *empty* in Writer when the Permissions pw has been set.

As reported, when a Permissions pw is *not set*, the ODF stream is fully read back into Writer.

@Dave, this seems like it might be of interest to you.

TB77 nightly for 20250925
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6f68c46d0aa5fe872de0dec8777d35ff91886043
CPU threads: 28; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 3 V Stuart Foote 2025-09-27 11:43:06 UTC
Should note that the PDF itself opens showing its content with any reader (Acrobat, Chrome) it is just our Hybrid PDF handling of opening back into source LO module when a Permissions pw has been set.
Comment 4 Dave Gilbert 2025-09-27 11:59:29 UTC
Hmm yeh that sounds like the filter choking on it.
Hmm yeh I'll try and remember the code I worked on with that a few months back.
I'll need to understand how the different passwords interact.
Comment 5 Dave Gilbert 2025-09-28 01:52:49 UTC
hmm yeh I can reproduce that here.
A couple of observations:
  - In the naming I see in tools the 'open password' is called the user password
    and the 'permission password' is called the owner password
  - either can be used to open the file in okular
  - our xpdfimport can open the pdf with either password
  - pdfdetach is fussy - you need to specify the right password to upw/opw
  - If I open the hybrid in okular and then export the odt, the odt is itself encrypted using the owner/permission password.
Comment 6 Dave Gilbert 2025-09-29 00:33:42 UTC
Stuart:
  I've stepped through the pdf filter side of this, and it looks happy to me.
I can see it's successfully opening the PDF, taking the password you give it and saving out the odt in the temporary file; if I quit lo and pass it that temporary it correctly prompts for the password and opens the odt.

So hmm; anyone know more about the filter system and/or where the password is checked for an encrypted odt?

I do see a warning in the failing case of:

warn:legacy.osl:134116:134116:sfx2/source/doc/sfxbasemodel.cxx:2077: There should be no Password property in the document MediaDescriptor!

I'm just wondering if that's the password left over from the pdf opening?