Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deny file mode changes outside of specified paths in sandbox #17708

Merged
merged 4 commits into from
Jul 13, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Library/Homebrew/sandbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def add_rule(allow:, operation:, filter: nil, modifier: nil)
def allow_write(path:, type: :literal)
add_rule allow: true, operation: "file-write*", filter: path_filter(path, type)
add_rule allow: true, operation: "file-write-setugid", filter: path_filter(path, type)
add_rule allow: true, operation: "file-write-mode", filter: path_filter(path, type)
end

sig { params(path: T.any(String, Pathname), type: Symbol).void }
Expand Down Expand Up @@ -289,6 +290,7 @@ class SandboxProfile
(regex #"^/dev/tty[a-z0-9]*$")
)
(deny file-write*) ; deny non-allowlist file write operations
(deny file-write-mode) ; deny non-allowlist file write mode operations
(allow process-exec
(literal "/bin/ps")
(with no-sandbox)
Expand Down
Loading