π‘οΈ Sentinel: Fix insecure socket creation in shared directories#100
π‘οΈ Sentinel: Fix insecure socket creation in shared directories#100
Conversation
Co-authored-by: minibota <1483356+minibota@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π Issue: The daemon created the Unix socket file directly in
/tmp(e.g.,/tmp/cc-agent-user.sock) whenXDG_RUNTIME_DIRwas missing. This location is shared and sticky, allowing local attackers to pre-create the file to cause Denial of Service (DoS) or exploit race conditions.π§ Risk: A local attacker could prevent the agent from starting or potentially intercept connections if race conditions are exploited.
π οΈ Fix:
ensureSocketDirto enforce0700permissions and ownership on the socket directory.getSocketPathto use a dedicated subdirectory based on Effective UID:/tmp/cc-agent-<euid>/cc-agent.sock.π§ͺ Tests:
TestEnsureSocketDirto verify directory creation, permission checks (0700), and rejection of insecure permissions.TestGetSocketPath_Structureto verify path generation logic.π Notes: This change is transparent to users but changes the default socket location on systems without
XDG_RUNTIME_DIR.execcommand automatically resolves the new path.This PR was created by an automated nightly security task.
PR created automatically by Jules for task 11022395506798640199 started by @minibota