Add permissive-ipc guard and built-in xcode capability#4
Add permissive-ipc guard and built-in xcode capability#4nithyanatarajan wants to merge 6 commits intojskswamy:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Review: Extend the capability model instead of adding guardsThe The issue is that the capability model currently only has vocabulary for filesystem and env operations. There's no field for "allow mach-lookup" or "allow iokit-open". Update:
|
Greptile SummaryThis PR introduces a Key changes:
Confidence Score: 4/5Mostly safe to merge; one unresolved prior issue ( The architecture is sound and well-tested. The
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["--with xcode<br/>or auto-detect (.xcodeproj / Package.swift)"] --> B["builtin xcode capability"]
B --> C["Writable: /Applications/Xcode.app<br/>Writable: ~/Library/Logs/CoreSimulator"]
B --> D["EnableGuard: permissive-ipc"]
B --> E["EnableGuard: xcode-simulator"]
D --> F["permissive-ipc guard (opt-in)"]
F --> F1["(allow mach-lookup)"]
F --> F2["(allow iokit-open)"]
F --> F3["(allow signal)"]
F --> F4["(allow job-creation)"]
F --> F5["(allow distributed-notification-post)"]
F --> F6["(allow user-preference-read/write)"]
F --> F7["(allow system-fsctl)"]
E --> G["xcode-simulator guard (opt-in)"]
G --> G1["file-read* file-write*<br/>~/Library/Developer"]
G --> G2["file-read* file-write*<br/>~/Library/Preferences ⚠️"]
G --> G3["file-read* file-write*<br/>~/Library/Caches/com.apple.dt.Xcode"]
G --> G4["file-read* file-write*<br/>~/Library/org.swift.swiftpm<br/>~/.swiftpm"]
G --> G5["file-read* file-write*<br/>~/.CFUserTextEncoding"]
Reviews (2): Last reviewed commit: "Auto-detect Xcode projects and suggest x..." | Re-trigger Greptile |
| Writable: []string{ | ||
| "/Applications/Xcode.app", | ||
| "~/Library/Logs/CoreSimulator", |
There was a problem hiding this comment.
/Applications/Xcode.app should be Readable, not Writable
/Applications/Xcode.app is listed under Writable, which grants the sandboxed agent write access to the entire Xcode application bundle — including its toolchain binaries, SDK headers, and frameworks. Normal Xcode build operations never need to write into the application bundle itself; artifacts go to ~/Library/Developer/Xcode/DerivedData (already covered by xcode-simulator guard's ~/Library/Developer subpath), simulator data to ~/Library/Developer/CoreSimulator, and caches to ~/Library/Caches/com.apple.dt.Xcode. Granting write access here would allow the agent to modify the Xcode IDE installation.
This path should be Readable (or even omitted if the toolchain executables are accessed via xcrun//usr/bin symlinks rather than directly from the app bundle):
| Writable: []string{ | |
| "/Applications/Xcode.app", | |
| "~/Library/Logs/CoreSimulator", | |
| Readable: []string{ | |
| "/Applications/Xcode.app", | |
| }, | |
| Writable: []string{ | |
| "~/Library/Logs/CoreSimulator", | |
| }, |
| seatbelt.SectionAllow("Process control"), | ||
| seatbelt.AllowRule("(allow signal)"), | ||
| seatbelt.AllowRule("(allow job-creation)"), |
There was a problem hiding this comment.
(allow signal) and (allow job-creation) are broader than necessary
(allow signal) without a target qualifier permits sending any signal to any process on the system, not just the agent's own children. Xcode toolchain processes (compiler workers, simulator daemons) only need to signal their own child processes. Apple's SBPL supports scoping this with (target children):
(allow signal (target children))
Similarly, (allow job-creation) allows registering arbitrary persistent launchd jobs, which survive beyond the sandbox session. If the intent is only to allow spawning sub-processes for xcodebuild/simctl, a more targeted rule would reduce the blast radius.
Since this guard is explicitly opt-in and named "permissive", this is a heads-up rather than a blocker, but it's worth documenting the decision in a comment so future readers understand why the broad form was chosen over scoped alternatives.
Summary
enable_guardfield toCapabilityDefso user-defined capabilities can activate opt-in guards from YAML configpermissive-ipcguard — reusable opt-in guard that broadly allows non-filesystem operations (Mach lookups, IOKit, signals, notifications,preferences, job creation, fsctl)
xcode-simulatorguard — Xcode-specific home directory filesystem pathsxcodecapability that enables both guards, activated via--with xcodeMotivation
Complex toolchains like Xcode use dozens of Mach services, IOKit classes, and IPC operations that vary by version. Enumerating them individually is
impractical — filesystem paths are the real security boundary. The
permissive-ipcguard captures this insight and is reusable by any capability.Test plan