Bug 475892 - KTextBuffer tries to authenticate as root to save a file even if the file is owned by the user
Summary: KTextBuffer tries to authenticate as root to save a file even if the file is ...
Status: REPORTED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.111.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-20 20:57 UTC by zocsfxljsgpmiuaanz
Modified: 2023-10-20 21:00 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zocsfxljsgpmiuaanz 2023-10-20 20:57:44 UTC
SUMMARY
When a file cannot be saved due to permission issues, KTextBuffer always tries to use the KAuth action "org.kde.ktexteditor.katetextbuffer.savefile" to save it as root. Even when the file is actually owned by the user and in a directory controlled by the user, but the user doesn't have write permissions (which, given that the file is theirs, is easy to change).


STEPS TO REPRODUCE
1. Remove the write permission of a text file owned by your user
2. Modify it with Kate, KWrite, or any application that uses KTextEditor
3. Try to save it

OBSERVED RESULT
A polkit dialog asking for authentication as root appears.

EXPECTED RESULT
Given that you can already change the permission without need of root, KTextEditor should probably simply inform the user about it, change the permission by itself, or something that doesn't involve unnecessary authentication as root.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.11