Skip to content

Harden ownership and permissions of cask apps - #24003

Merged
MikeMcQuaid merged 1 commit into
mainfrom
cask-app-permissions
Sep 16, 2026
Merged

MikeMcQuaid merged 1 commit into
mainfrom
cask-app-permissions

Conversation

@MikeMcQuaid

@MikeMcQuaid MikeMcQuaid commented Sep 16, 2026

Copy link
Copy Markdown
Member
  • Remove group and other write permissions from every app and use the platform's default cask group.
  • Add read and execute access for all users only in system directories, preserving existing read and execute permissions elsewhere.
  • Avoid following symlinks when changing groups and request sudo only if the unprivileged change fails.

Fixes #24002


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Codex with GPT 6 Astra at Extra High effort, with local review and testing.


Copilot AI balanced review requested due to automatic review settings September 16, 2026 15:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃煛 Changes recommended

The system-directory guard still classifies user-local absolute paths as system paths, stripping their write permissions.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Restricts write permissions on cask apps installed in system directories.

Changes:

  • Removes group and other write bits recursively.
  • Adds permission-preservation and restriction tests.
File summaries
File Description
Library/Homebrew/cask/artifact/app.rb Tightens installed app permissions.
Library/Homebrew/test/cask/artifact/app_spec.rb Tests permission handling.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.


馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Library/Homebrew/cask/artifact/app.rb Outdated
@MikeMcQuaid MikeMcQuaid changed the title Restrict write permissions for system cask apps Harden ownership and permissions of cask apps Sep 16, 2026
- Remove group and other write permissions from every app and use the
  platform's default cask group.
- Add read and execute access for all users only in system directories,
  preserving existing read and execute permissions elsewhere.
- Avoid following symlinks when changing groups and request `sudo`
  only if the unprivileged change fails.

Fixes #24002

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃數 Needs a closer look

Recursive cross-platform ownership and permission changes require final human validation.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Sep 16, 2026
Merged via the queue into main with commit 99fd9a8 Sep 16, 2026
52 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the cask-app-permissions branch September 16, 2026 17:12
@ricardojoaoreis

ricardojoaoreis commented Sep 16, 2026

Copy link
Copy Markdown

Hey! I have this env variable set HOMEBREW_CASK_OPTS=--appdir=~/Applications to install casks on my user's Applications directory and now every install/upgrade prompts for sudo. Installing an .app from a .dmg to that directory is allowed without elevated permissions but, since this commit, doing it with Homebrew is not possible.

@MikeMcQuaid

Copy link
Copy Markdown
Member Author

@ricardojoaoreis will be fixed by #24011

@ricardojoaoreis

Copy link
Copy Markdown

Thanks @MikeMcQuaid! And thanks for the amazing work all these years!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] Homebrew preserves upstream group-writable permissions in application bundles installed into a shared system application directory

4 participants