You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: implement privilege dropping to run subprocess as original user
This is the core fix for sudo environment preservation. Previously, we were
only restoring environment variables but the subprocess was still running
as root. Now we properly drop privileges to the original user.
Changes:
- Linux: Use syscall.Credential to set UID/GID of subprocess
- macOS: Use syscall.Credential to set UID/GID, preserve original group behavior for non-sudo
- Both platforms now check SUDO_USER and drop privileges accordingly
- Added proper error handling and debug logging for privilege dropping
Now 'sudo jail -- whoami' will return the original username instead of 'root'.
Co-authored-by: f0ssel <[email protected]>
0 commit comments