Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix symlink vulnerability in config permissions enforcement#277

Open
acebytes wants to merge 1 commit into
mainfrom
sentinel/fix-chmod-symlink-vuln-1132927680054077846
Open

πŸ›‘οΈ Sentinel: [CRITICAL] Fix symlink vulnerability in config permissions enforcement#277
acebytes wants to merge 1 commit into
mainfrom
sentinel/fix-chmod-symlink-vuln-1132927680054077846

Conversation

@acebytes
Copy link
Copy Markdown
Contributor

  • 🚨 Severity: CRITICAL
  • πŸ’‘ Vulnerability: The daemon used chmod to enforce 0600 permissions on the autopilot.json config file. Because chmod follows symlinks, an attacker could replace the config file with a symlink to a sensitive system file, causing the daemon to alter its permissions.
  • 🎯 Impact: Local privilege escalation / Denial of Service. An attacker could alter the permissions of arbitrary files.
  • πŸ”§ Fix: Replaced chmod with open(O_NOFOLLOW) and fchmod() to securely change permissions only if the path is not a symlink.
  • βœ… Verification: Verified the code changes correctly use O_NOFOLLOW and all existing tests pass.

PR created automatically by Jules for task 1132927680054077846 started by @acebytes

…nforcement

Co-authored-by: acebytes <2820910+acebytes@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebfba5b032

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// Enforce 0600 permissions safely, preventing symlink attacks
URL(fileURLWithPath: path).withUnsafeFileSystemRepresentation { pathPtr in
guard let ptr = pathPtr else { return }
let fd = open(ptr, O_RDONLY | O_NOFOLLOW)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Open config fd without requiring read permission

Opening autopilot.json with O_RDONLY | O_NOFOLLOW makes permission repair fail whenever the file exists but is not currently readable (for example mode 0200 or 0000), because open returns EACCES before fchmod can run. That causes the subsequent contents(atPath:) read to fail and the daemon to treat the config as broken, whereas the previous chmod(path, 0o600) path could recover these owner-mispermissioned files. This is a functional regression in config reload behavior for restricted-but-valid files.

Useful? React with πŸ‘Β / πŸ‘Ž.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant