Harden daemon: enforce the API socket resolves inside COVEN_HOME (AUTH.md L134)#150
Open
maplesyzzurp wants to merge 1 commit into
Open
Harden daemon: enforce the API socket resolves inside COVEN_HOME (AUTH.md L134)#150maplesyzzurp wants to merge 1 commit into
maplesyzzurp wants to merge 1 commit into
Conversation
…TH.md L134) docs/AUTH.md's "Current hardening gap" requires failing closed when the socket path resolves outside COVEN_HOME, or when socket creation/cleanup would cross the trusted state directory boundary. The path is built as `<coven_home>/coven.sock`, so that held only by construction; make it an explicit guard in bind_api_socket so a future change cannot let it escape.
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.
Closes the socket-path-containment item from
docs/AUTH.md's "Current hardening gap" (L134/L136): the daemon should fail closed when the socket path resolves outsideCOVEN_HOME, or when socket creation/cleanup would cross the trusted state-directory boundary.What
bind_api_socketnow verifies the socket path is a direct child ofCOVEN_HOMEbefore touching it:daemon_socket_path()builds<coven_home>/coven.sock, so this held only by construction. The guard makes the invariant explicit, so a future refactor (e.g. a configurable socket path) can't silently let socket creation or cleanup escape the trusted directory.Together with #144 (symlink/non-socket) and #148 (ownership), this completes the AUTH.md daemon-hardening list.
Tests
daemon_socket_path_stays_inside_coven_homeinvariant test.cargo test --workspacegreen,clippy -D warningsclean,fmtclean.Focused hardening change, in the same vein as #144 / #145 / #148.