Commit Graph
9 Commits
Author SHA1 Message Date
Mike McQuaid 377e4f740b Remove Bubblewrap, use Landlock for Linux sandbox
- Landlock needs no separate executable, installation or `sysctl`
  configuration, so use it as the only Linux sandbox implementation
  rather than an opt-in behind `$HOMEBREW_SANDBOX_LINUX_LANDLOCK`.
- Delete `Sandbox::Bubblewrap`, the `brew setup-sandbox` command and
  the implicit `bubblewrap` dependency, none of which Landlock needs.
- Remove the Bubblewrap-era `Sandbox` API (`ensure_sandbox_installed!`,
  `configure!`, `configuration_commands`, `sandbox_install_command`)
  and its call sites now that no backend needs installing or
  configuring.
- Simplify `brew doctor`'s `check_linux_sandbox` to report the
  Landlock failure reason with the `$HOMEBREW_NO_SANDBOX_LINUX`
  workaround.
2026-08-04 11:55:32 +01:00
Mike McQuaid a2e882527d Support Landlock ABI 2 on Linux kernel 6.1
- Amazon Fargate's kernel 6.1 only provides Landlock ABI 2, which the
  previous `MINIMUM_ABI` of 3 rejected outright.
- ABI 2 can still permit cross-directory renames via `ACCESS_FS_REFER`;
  it only lacks `ACCESS_FS_TRUNCATE`, noted on `MINIMUM_TRUNCATE_ABI`
  as truncation has no profile rule that could gate a warning.
- Mask device path rules with `handled_access_fs` so the `/dev/full`
  truncate bit no longer makes `landlock_add_rule(2)` fail with
  `EINVAL` on ABI 2.
- Warn that network access cannot be restricted at all below ABI 4
  rather than implying partial restrictions were applied.
2026-07-28 13:39:03 +01:00
Mike McQuaid 204ea7e964 Make tests use public APIs and enable their cops
- Make every statically-poked method public and call it directly,
  keeping `public_send` only for dynamically-named public methods.
- Read and write state through public `attr_*` accessors instead of
  instance variable reflection.
- Enable `Homebrew/NoSendInTests` and
  `Homebrew/NoInstanceVariableAccessInTests` now the test suite is
  clean, so neither pattern creeps back in.
- Keep rare justified disables, e.g. `Module#remove_const` is
  private core Ruby and raw memoisation state has no accessor.
2026-07-27 08:11:46 +01:00
Mike McQuaid 74724c2f79 Unblock POSIX message queues in Landlock
- Sandboxed glibc tests open POSIX queues for reading and fail with
  `EACCES` when Landlock handles read restrictions.
- Limit the extra right to read-restricted profiles because Landlock
  rejects rights omitted from the ruleset's handled mask.
2026-07-25 19:17:01 +01:00
Mike McQuaid 3379ef3f61 Allow Landlock access to devices and IPC
- permit standard terminal and ENOSPC device operations
- permit POSIX shared memory and message queues
- select Landlock without installing Bubblewrap in Linux tests
2026-07-24 21:22:15 +01:00
Mike McQuaid 0fc95a988a Output Landlock ABI version in brew config
- Landlock is a kernel ABI with no user-visible version so there was
  no easy way to see what a given system supports.
- `Sandbox::Landlock.kernel_abi_version` probes the kernel even when
  `HOMEBREW_NO_SANDBOX_LINUX` is set so `brew config` reports what
  the system provides rather than what Homebrew will use.
2026-07-24 15:47:23 +01:00
Mike McQuaid f4d65a6c9b Allow PTYs in Landlock sandboxes
- Grant write and ABI-aware ioctl access only to Linux PTY devices.
- Cover the Ruby `PTY.spawn` regression.
2026-07-23 14:41:05 +01:00
Mike McQuaid bb95e74815 Use Landlock sandbox in Linux CI 2026-07-23 11:35:10 +01:00
Mike McQuaid af7c490e70 Add Landlock sandbox implementation 2026-07-23 10:56:57 +01:00