‹ BackHN Continuity

Thread

Updates to Full Disk Access in macOS

309 points · 219 comments · notfirstpost

  1. moecables · · focus · HN ↗
    IMHO, it's good to add more specific controls for this. After reading this, I went and checked my list of app with full disk access:

    - Ghostty (fine, it's my terminal)

    - Alfred (fine, I use it for searching everywhere)

    Then I have a few turned off:

    - Spotify (why does it need full disk access) ??

    - Gemini (nope, don't need it to know everything about my computer)

    1. coderbants · · focus · HN ↗
      Terminal is a significant risk though and I’d still really like to see macOS improve the APIs around filesystem access.

      Granting terminal full disk access grants arbitrary scripts full disk access. There’s a lot you can do with ACLs and the permissions system, but it’s not reflected in the UI for settings.

      Then there’s allowing access to documents, downloads, desktop, external disks. This should really allow the user to select a path or paths for applications, because these options are way too broad (especially external disks).

      1. [deleted] · · focus · HN ↗

        [deleted]

      2. ashishb · · focus · HN ↗
        > Granting terminal full disk access grants arbitrary scripts full disk access.

        Indeed, I run all dev tools including coding agents inside sandbox now

        <a href="https:&#x2F;&#x2F;github.com&#x2F;ashishb&#x2F;amazing-sandbox" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ashishb&#x2F;amazing-sandbox

        1. jackjeff · · focus · HN ↗
          I do the same but I rely on devcontainers because editors like vscode, zed, etc… provide native support. It seems easier to use than asb.

          If you open a project using a devcontainer it prompts you to build one. As long as you install all the tools you need in it, it just works.

          Orbstack is much nicer than Docker to host the containers.

      3. jshier · · focus · HN ↗
        This is why I use Terminal as my primary terminal, and iTerm as my AI terminal. iTerm gets no permissions, I move specific things to Terminal to do it. Plus I can then style them to optimize for the different usages. And iTerm has better harness hooks anyway.

        I would still like to see not only more granular permissions, but single use permissions. Once I grant iTerm access to Documents for whatever reason, it always has such permission. I would be nice to limit that to a single use, or a single harness session.

      4. ghusto · · focus · HN ↗
        &gt; Granting terminal full disk access grants arbitrary scripts full disk access

        No, it grants scripts I run full disk access. Unvetted scripts do not run in my terminal, so there are no secret sub-processes either.

      5. m463 · · focus · HN ↗
        I would want terminal and all its subprocesses to have full disk access - I do tons of stuff from the command line and don&#x27;t run nonsense stuff.

        get out of my way.

    2. smcleod · · focus · HN ↗
      I wouldn&#x27;t allow your terminal full disk access, that&#x27;s quite a risk vector.
    3. 0c3ca83 · · focus · HN ↗
      - Ghostty (fine, it&#x27;s my terminal)

      But your terminal shouldn&#x27;t be accessing any files; you just need to be able to launch &#x2F;bin&#x2F;zsh or whatever you use as your shell. The shell needs to be able to access files, but its container doesn&#x27;t.

      Of course, you could go farther. For example, on OpenBSD, even &#x2F;bin&#x2F;ksh has been somewhat sandboxed; it can see most of the file system, but the things it can do have been limited:

        if (pledge(&quot;stdio rpath wpath cpath fattr flock getpw proc &quot;
            &quot;exec tty id&quot;, NULL) == -1) {
      1. saagarjha · · focus · HN ↗
        macOS attributes shell commands to their parent app bundle.
        1. joshspankit · · focus · HN ↗
          Indeed. It’s very inconvenient to ‘cd` and have to do the whole permission dance to read a file
        2. 0c3ca83 · · focus · HN ↗
          That seems like a massive hole in the model that would make it very hard to lock down multi-process&#x2F;privsep programs like sshd.
          1. saagarjha · · focus · HN ↗
            Sandboxing something like that is challenging, yes. But probably not for this reason you can always disclaim responsibility for your process.
            1. 0c3ca83 · · focus · HN ↗
              It really isn&#x27;t; the program just needs to be able to declare what it expects it should be able to do, and what it expects its children should be able to do. The latter doesn&#x27;t need to be a subset of the former.
              1. saagarjha · · focus · HN ↗
                This is really hard to do in general
                1. 0c3ca83 · · focus · HN ↗
                  It&#x27;s done on the majority of the OpenBSD base system, as well as important ports like Chrome and Firefox. Linux also has the parts to do this, though it&#x27;s more fragile and complicated.
                  1. saagarjha · · focus · HN ↗
                    To be clear I have a much higher standard for what is acceptable than that, you really need to consider software that a hundred million people are going to use
                2. eviks · · focus · HN ↗
                  Indeed, is only the OS mastermind had billions and years to fix the foundation...
                  1. saagarjha · · focus · HN ↗
                    While looking at resources invested is necessarily a great measure of difficulty, it is somewhat indicative, yes.
                    1. eviks · · focus · HN ↗
                      you mean &quot;isn&#x27;t&quot;? Though there is no indication that a lot was invested, so doesn&#x27;t give you the measure (my comment was about the availability of resources, not of their actual use)
                      1. saagarjha · · focus · HN ↗
                        I did yes, sorry
              2. dcrazy · · focus · HN ↗
                That “just” is doing a LOT of work.
                1. 0c3ca83 · · focus · HN ↗
                  It&#x27;s already done on OpenBSD, and linux has the pieces to do it, though it&#x27;s far more fragile and complicated. I&#x27;m not speaking hypothetically here, I&#x27;ve implemented code that works this way.
                  1. dcrazy · · focus · HN ↗
                    You are minimizing the difference in scope between the audience and applications of OpenBSD and those of macOS.

                    macOS has had a capabilities model for over a decade called App Sandboxing. It would be entirely impractical to expect app authors to correctly declare their permissions up front and for users to audit them. Hence the permissions granted to sandboxed apps are pre-determined by the OS, and can be extended through explicit user interaction.

              3. comex · · focus · HN ↗
                The latter does need to be a subset of the former, or else an attacker can trivially work around limitations on &quot;what it should be able to do&quot; by spawning a child instead of doing the thing directly.

                But yes, it&#x27;s unfortunate that macOS sandboxes cannot be nested.

                1. mrob · · focus · HN ↗
                  &gt;The latter does need to be a subset of the former, or else an attacker can trivially work around limitations on &quot;what it should be able to do&quot; by spawning a child instead of doing the thing directly.

                  That assumes you&#x27;re only defending against malicious code. Spawning children with limited functionality is a useful defense against non-malicious code being exploited by malicious data, even if those children have privileges the parent lacks.

                2. saurik · · focus · HN ↗
                  This position is trivially incorrect as it makes the entire concept of a login shell impossible in the first place, as you have just described the regime in which login, su, and even basic tools like ping (which have the permission to use raw sockets and write ICMP even though we would never let any of its parents do so) operate.

                  Terminal (and sshd) are special, in that they actually do end up with inherent transitive permission to their immediate intended child processes, as those children are nigh-unto universally (due to the entire idea of what terminals do) designed to be operated using text written to their input, which Terminal (and sshd) can man-in-the-middle.

                  But like, that doesn&#x27;t generalize: it certainly (and obviously) is the case that I can have a process that is allowed to write files to disk that I would be happy to let you run even if I do not trust you to write to even those same files (as you will corrupt them), much less any file on my disk, as I merely need to trust that application to not give you the ability to do arbitrary writes.

                  The better idea here is that processes are their own form of encapsulation, and just because they can do something doesn&#x27;t mean that they expose that functionality. You thereby must limit what tools can be used by a parent -- so almost no one gets a generic &quot;exec&quot; permission: you get a whitelist of tools and arguments you can utilize -- but the result doesn&#x27;t look much at all like the permissions on subprocesses needing be a subset of the parent.

                  1. comex · · focus · HN ↗
                    Yes, and macOS entitlements work similarly, as you know. I was interpreting “what it expects its children should be able to do” as a single rule for all child processes, like in OpenBSD pledge() which the parent seems to be referring to. Sure, such a rule could securely be greater than the parent’s own permissions if you strictly limit what processes can be executed with what arguments.

                    Actually, there’s another exception to my previous statement that I should have mentioned. For mitigations that are meant to prevent an attacker from turning memory corruption into code execution or code-execution-like control – such as restrictions on mapping memory executable (at least that’s one purpose for such restrictions), or memory map lockdown – the mitigations’ effectiveness doesn’t depend on whether they’re applied to children. Those mitigations are sometimes treated as part of the sandbox system, sometimes separate.

              4. mindwok · · focus · HN ↗
                If the child could do different things to the parent malicious processes would spawn child processes to do stuff they shouldn’t be able to do, though
      2. rolosa · · focus · HN ↗
        If you try to ls &#x2F; for example it&#x27;s going to pop up a request to access your disk, multiple times. It&#x27;s rather annoying.
        1. 0c3ca83 · · focus · HN ↗
          Why would ghostty try to access your disk when you run &#x27;ls &#x2F;&#x27;? ghostty isn&#x27;t opening any files -- ls is.
          1. dcrazy · · focus · HN ↗
            The TCC system attributes the access to Ghostty because that’s the thing the user understands as the app they are interacting with. Otherwise every `posix_spawn()` and `system()` call would result in a new TCC prompt attributed to an inscrutable name.
          2. kmeisthax · · focus · HN ↗
            ls does not live in an .app bundle and it is not managed by launchd. The TCC framework (which implements sandboxing on macOS) and the rest of the UI only respects .app bundles since that&#x27;s the thing the user sees. The fact that ghostty is fork&#x2F;execing another process to to the disk access is immaterial to it - hell, if Apple had their way only launchd and Safari would be able to spawn processes at all (like on iOS).

            I mean, think about it: what would it mean if ls had a separate sandbox identity from the shell that spawned it? It would mean that any process on the system not entitled to read files from disk could get that entitlement by just fork&#x2F;execing ls and parsing its stdout. That&#x27;s not a security boundary that makes sense. ls doesn&#x27;t read files - ghostty reads files, and ls is just its deputy.

      3. OJFord · · focus · HN ↗
        ghostty is the .app, perhaps it makes more sense if you imagine some other app, Spotify.app say, imagine for whatever reason it shells out to ls for listing files, it will show as Spotify requesting access not ls.
    4. king_geedorah · · focus · HN ↗
      Spotify has (had? I no longer use it) a feature that would allow you to make local media available as part of your library anywhere so long as your machine was on and connected to the internet. I would imagine that feature requires disk access under these sandbox &#x2F; permission models.

      Edit: I should say, the model it was created with (select a folder, all media in that folder is mirrored) requires such permissions. One could imagine designs that don’t.

      1. crooked-v · · focus · HN ↗
        That sounds like something doable with the ordinary select-a-folder permission picker, no full disk access needed.

        The gap here in functionality is between &#x27;single manually specified folder&#x2F;file&#x27; and &#x27;entire disk&#x27;.

      2. Hobadee · · focus · HN ↗
        &gt; had?

        Still does, at least on Windows. I use it all the time - I have a playlist with a mix of Spotify music, and music from my server.

    5. musicale · · focus · HN ↗
      But how is Gemini going to repair your filesystem and restore lost or deleted data?
      1. Joker_vD · · focus · HN ↗
        It won&#x27;t need to if it can&#x27;t break my filesystem or lose and delete my data in the first place.
    6. jeroenhd · · focus · HN ↗
      I haven&#x27;t tested Apple&#x27;s access model, but is there something that&#x27;s stopping Gemini from launching `ghostty -e &#x2F;bin&#x2F;sh malware.sh`?

      Windows&#x27; Vista-era UAC protections have been bypassed through lolbins since the day of its inception (although officially UAC is not a security boundary according to MS) and apps like Ghostty might punch a hole through disk access controls in the same manner.

    7. gregoriol · · focus · HN ↗
      So if your terminal has access, your claude in the terminal has access too? that doesn&#x27;t fix anything
    8. chrisjj · · focus · HN ↗
      Windows Vista reborn :(
      1. Hobadee · · focus · HN ↗
        Came across this blast from the past the other day. Funny how the tables have turned.

        <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=VuqZ8AqmLPY" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=VuqZ8AqmLPY

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.