Remix.run Logo
▲ 0c3ca83 5 hours ago

- Ghostty (fine, it's my terminal)

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

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

  if (pledge("stdio rpath wpath cpath fattr flock getpw proc "
      "exec tty id", NULL) == -1) {
▲rolosa 5 hours ago | parent | next [-]

If you try to ls / for example it's going to pop up a request to access your disk, multiple times. It's rather annoying.

▲0c3ca83 3 hours ago | parent [-]

Why would ghostty try to access your disk when you run 'ls /'? ghostty isn't opening any files -- ls is.

▲dcrazy 3 hours ago | parent [-]

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.

▲saagarjha 5 hours ago | parent | prev [-]

macOS attributes shell commands to their parent app bundle.

▲0c3ca83 3 hours ago | parent | next [-]

That seems like a massive hole in the model that would make it very hard to lock down multi-process/privsep programs like sshd.

▲saagarjha 3 hours ago | parent [-]

Sandboxing something like that is challenging, yes. But probably not for this reason you can always disclaim responsibility for your process.

▲0c3ca83 3 hours ago | parent [-]

It really isn'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't need to be a subset of the former.

▲dcrazy 3 hours ago | parent | next [-]

That “just” is doing a LOT of work.

▲0c3ca83 2 hours ago | parent [-]

It's already done on OpenBSD, and linux has the pieces to do it, though it's far more fragile and complicated. I'm not speaking hypothetically here, I've implemented code that works this way.

▲dcrazy 2 hours ago | parent [-]

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.

▲saagarjha 3 hours ago | parent | prev [-]

This is really hard to do in general

▲eviks an hour ago | parent | next [-]

Indeed, is only the OS mastermind had billions and years to fix the foundation...

▲0c3ca83 2 hours ago | parent | prev [-]

It'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's more fragile and complicated.

▲joshspankit 5 hours ago | parent | prev [-]

Indeed. It’s very inconvenient to ‘cd` and have to do the whole permission dance to read a file