Skip to content

Explore OS-level sandboxing for hook execution #2154

@j178

Description

@j178

I’d like to explore adding optional OS-level sandboxing around hook execution, using platform capabilities such as macOS Seatbelt and Linux Landlock.

This could help with two related goals:

  1. Enforce read-only hooks
    Some hooks are intended to only inspect files. If that can be enforced by the OS, prek could run those hooks more aggressively in parallel without worrying about file write conflicts.

  2. Reduce risk from third-party hooks
    Remote hooks execute third-party code. A sandbox could reduce the impact of accidental or malicious behavior by limiting what hook processes can access or modify.

This should likely start as an opt-in capability, with clear behavior when sandboxing is unavailable on the current platform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaJust an idea

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions