Improve fm-shim-backend security and D-Bus error handling#358
Open
assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
Open
Improve fm-shim-backend security and D-Bus error handling#358assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
Conversation
…ene, systemd sandboxing, and cleanup - Add DBUS_NAME_FLAG_DO_NOT_QUEUE and terminate on IN_QUEUE to prevent silent name takeover after another owner exits - Send proper D-Bus error replies for unrecognized methods, wrong object paths, and wrong interfaces instead of leaving callers hanging - Close inherited file descriptors in child process before execve to avoid leaking the D-Bus socket to the frontend - Add systemd sandboxing directives (NoNewPrivileges, ProtectSystem, ProtectHome, PrivateTmp, etc.) to the user service - Add explicit dbus_connection_unref/dbus_error_free on main loop exit https://claude.ai/code/session_01CgrrFhhVWtqtfhvJdEcBWm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the security and robustness of the fm-shim-backend service by implementing file descriptor cleanup in child processes, improving D-Bus error handling, and adding systemd hardening options.
Key Changes
File Descriptor Management:
/proc/self/fdbefore executing the frontend processD-Bus Improvements:
DBUS_NAME_FLAG_DO_NOT_QUEUEflag, preventing the service from queuing if the name is already takenSystemd Hardening:
NoNewPrivileges=yes- Prevents privilege escalationProtectSystem=strict- Read-only access to system directoriesProtectHome=read-only- Read-only access to home directoryPrivateTmp=yes- Private temporary directoryRestrictNamespaces=yes- Restrict namespace creationRestrictRealtime=yes- Disable real-time schedulingMemoryDenyWriteExecute=yes- Prevent executable memory allocationLockPersonality=yes- Lock process personalityImplementation Details
opendir()andreaddir()to enumerate file descriptors safelystrtol()with proper error checkinghttps://claude.ai/code/session_01CgrrFhhVWtqtfhvJdEcBWm