Skip to content

Seatbelt: allow the preferences service (cfprefsd and its shared memory) without opening the user's preferences #1802

Description

Description of the new feature / enhancement

A workload that calls CFPreferencesAppSynchronize cannot run under the Seatbelt profile the SDK generates, and the v1 API offers no narrow way to allow it.

We hit this running OpenAI's Codex CLI (0.159.3) as a contained process: when a thread starts, Codex synchronizes its managed preferences (CFPreferencesAppSynchronize("com.openai.codex")) and treats a false answer as fatal. Its app-server then answers thread/start with:

failed to load configuration: Failed to synchronize managed preferences

Any program that reads managed (MDM) preferences through CoreFoundation is likely to fail the same way.

Environment: @microsoft/mxc-sdk 1.1.0, containment: { type: 'process' } on macOS 26.7.2 (arm64), the default filesystem and network policy shapes (tool paths and user-profile helpers read-only, a read-write working folder, egress denied except through runtimeConfig.networkProxy).

What we measured (the profile came from mxc-exec-mac --debug, then was passed back as a profileOverride with one rule added at a time):

  • The generated profile is (deny default) and holds no rule for POSIX shared memory, for com.apple.cfprefsd.*, or for user-preference-*.
  • The smallest addition that makes Codex start is these two rules:
    (allow ipc-posix-shm-read* (ipc-posix-name-prefix "apple.cfprefs."))
    (allow mach-lookup (global-name "com.apple.cfprefsd.daemon") (global-name "com.apple.cfprefsd.agent"))
    
    The shared-memory rule alone fails. The lookups alone fail. Either lookup without the other fails. user-preference-read is not needed.
  • With the two rules, the user's preferences stay closed. From inside, defaults read -g, defaults read com.apple.finder and defaults write <domain> all still fail. Controls: adding (allow user-preference-read) makes the reads succeed, and adding (allow user-preference-write) makes the write succeed. The rest of the containment holds: writes and reads outside the grants fail, Keychain items are not found, and egress goes only through the proxy.
  • With the two rules, Codex completes a full turn inside the sandbox.

What the v1 API offers today, and why none of it fits:

Option Result
seatbelt.extraMachLookups: ['com.apple.cfprefsd.daemon', 'com.apple.cfprefsd.agent'] still fails: it has no shared-memory rule
seatbelt.keychainAccess: true still fails, and opens far more than this needs
seatbelt.guiAccess: true (with UI enabled) starts, but opens every Mach service and shared-memory writes
seatbelt.profileOverride works, but the API never returns the generated profile to extend, so the caller has to rebuild the SDK's profile and keep it in step with each release

Proposed technical implementation details

Any one of these would solve it, in order of preference:

  1. A narrow Seatbelt option, for example seatbelt.preferencesService: true, that emits exactly the two rules above. It would leave user-preference-read and user-preference-write denied.
  2. A way to append rules to the generated profile, for example seatbelt.extraProfileRules: string[], so a caller can add a grant without taking over the whole profile.
  3. An API that returns the generated profile for a request (what mxc-exec-mac --debug prints), so a profileOverride can be built from it rather than written by hand.

Two related observations from the same investigation:

  • seatbelt.captureDenials is accepted by the helper's 1.1.0-alpha request format, but the v1 API of 1.1.0 refuses it (unknown field captureDenials, expected one of profileOverride, guiAccess, nestedPty, keychainAccess, extraMachLookups).
  • When called directly, captureDenials (and --audit) fail for a non-administrator user: '/usr/bin/log stream' exited unexpectedly: log: Must be admin to run 'stream' command. A note in the docs would help.

Activity

  1. added
    Backend-SeatbeltmacOS process isolation implemented with Seatbelt.
    and removed
    Needs-TriageHas not yet been reviewed, classified, and routed.
    on Nov 18, 2026
  2. theelliotm commented on Nov 18, 2026

    @theelliotm
    Contributor

    #1720 is fixing to merge soon. It adds seatbelt.customPosixShm, which will let you add custom shared memory grants at different read/write/create/delete access levels.

    I am also working on adding default mach/posix/iokit rules in an upcoming PR - I will do a bit more digging on com.apple.cfprefsd.* and user-preference-*.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Backend-SeatbeltmacOS process isolation implemented with Seatbelt.Issue-FeatureA request for new or expanded product functionality.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions