Bug 170067 - Writer: Unprotect section needs to ask for set password
Summary: Writer: Unprotect section needs to ask for set password
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha1+
Hardware: All All
: medium normal
Assignee: Jim Raykowski
URL:
Whiteboard: target:26.8.0 target:26.2.0.2
Keywords: bibisected, bisected, implementationError
Depends on:
Blocks: Navigator Section
  Show dependency treegraph
 
Reported: 2025-12-20 15:10 UTC by Timur
Modified: 2025-12-22 13:19 UTC (History)
2 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 Timur 2025-12-20 15:10:13 UTC
Insert-Section to add section protected with password.
In Navigator-Sections right click on the section, see Protect Section checked.
Click on that, it removes protection without asking for password.

Expected: ask for password, as when removing via Format-Sections.

Protect ite added to Sections in tdf#157681.
Comment 1 Jim Raykowski 2025-12-20 21:55:39 UTC
Hi Timur, Yep I missed this when implemented. Thanks for catching. Patch for expected results in progress...
Comment 2 Commit Notification 2025-12-21 05:58:10 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/be2212824d4271e71c25706a790d0f4928bdf43a

tdf#170067 SwNavigator: Unprotect section needs to ask for set password

It will be available in 26.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Jazevedo 2025-12-21 12:13:05 UTC
Hi Jim, 

Thank you for this fix. I tested it in latest master, and I noticed a small issue, that I am not sure if it is expected or not. 

When you uncheck a section protection from the navigator bar a first time, it will now ask you for the password. 

However if a user, then re enables the section protection from the navigator sidebar, and then unchecks it a second time, on this second time it will NOT ask for the password. 

If you lock the section protecting again (while in this state when it no longer asks for password) and then save the document; when reopening the document it will not ask for the password again, at all. 


Version: 26.8.0.0.alpha0+ (X86_64)
Build ID: 56384aa312dff642962db8d2792c9f66d0b08707
CPU threads: 20; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: pt-PT (pt_PT.UTF-8); UI: en-US
Calc: threaded
Comment 4 Jim Raykowski 2025-12-21 19:17:00 UTC
(In reply to Jazevedo from comment #3)

Removal of the password for password protected sections when protection is removed is probably not what is expect.

Here is a patch that does not remove the password (if one is set) when protection is removed:
https://gerrit.libreoffice.org/c/core/+/196049
Comment 5 Commit Notification 2025-12-21 22:17:21 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b70f87d395c689b075c74afb4068794333fc41ea

tdf#170067 SwNavigator: Unprotect section needs to ask for set password

It will be available in 26.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Jazevedo 2025-12-21 22:26:50 UTC
> Affected users are encouraged to test the fix and report feedback.

The patches solved the problem for me. 

With the second patch it always asks for a password when unchecking section protection from the checkbox on the navigator. And not just the first time. 

Even if the file is saved with that option unchecked, if you reopen the file and check/uncheck, it will also ask for the password.

Thanks for the fix  Jim Raykowski.

Tested the fix on: 

Version: 26.8.0.0.alpha0+ (X86_64)
Build ID: b70f87d395c689b075c74afb4068794333fc41ea
CPU threads: 20; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: pt-PT (pt_PT.UTF-8); UI: en-US
Calc: threaded
Comment 7 Jim Raykowski 2025-12-21 22:46:08 UTC
@Jazevedo, Thank you for testing.
Comment 8 Commit Notification 2025-12-22 13:19:53 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "libreoffice-26-2":

https://git.libreoffice.org/core/commit/f7d848e4e2c244bd75d5c273023309cc3f7b3420

tdf#170067 SwNavigator: Unprotect section needs to ask for set password

It will be available in 26.2.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.