-
-
Notifications
You must be signed in to change notification settings - Fork 66
Fix permission groups #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
This PR works in theory, but seems to crash on the second keypress. When handling the first keypress, |
a3ae861 to
42fce57
Compare
|
Yeah. it looks great now. Thanks! |
|
Hey @heyzec Does this pr work on your end? I'll merge it then |
|
Hi @Shinyzenith , yes this PR does resolve the linked issue, appreciate if you can merge it |
|
Hi can you run format on this pr once? I'm ready to merge @andycandy-dev |
|
sorry, I'm out on holidays for a week, could get back to this on December 11. |
Problem
Terminal emulators and other applications launched via swhkd were missing supplementary groups, causing permission issues. This occurred when the user's GID differs from their UID (e.g., on NixOS and some enterprise Linux distributions).
The root cause was that the code only called
setgid()andsetuid()without callinginitgroups()to set supplementary groups. Additionally, it incorrectly assumed UID equals GID, passing the UID value tosetgid().Solution
This PR properly sets user privileges when spawning commands by:
Command::uid()andCommand::gid()to run child processes with correct privilegesinitgroups()automatically when setting uid/gid on the child processChanges:
std::os::unix::process::CommandExtfor.uid()and.gid()methods.uid()and.gid()on the Command builder instead of callingsetuid()/setgid()in the parent processRelated
This follows the same approach used in commit 6b1e62e to fix CVE-2022-27814 and CVE-2022-27819, but applies it to command execution rather than just config file loading.
fixes #320
Testing
Tested on systems where UID ≠ GID (nixOs). Verified that spawned processes now have all supplementary groups correctly set.