class LittleGhost::Sandboxes::Native
Selects the operating system’s built-in LittleGhost isolation backend. Selection fails closed on unsupported platforms and never falls back to unrestricted host execution.
Public Class Methods
# File lib/little_ghost/sandboxes/native.rb, line 24 def initialize(workspace:, platform: RUBY_PLATFORM, **options) implementation = if platform.include?("darwin") Seatbelt elsif platform.include?("linux") Bubblewrap else raise UnsupportedPlatformError, "native sandboxing is unavailable on #{platform}" end @backend = implementation.new(workspace:, platform:, **options) super(workspace:, policy: @backend.policy, limits: @backend.limits) end
Selects Seatbelt on macOS or Bubblewrap on Linux and builds that backend around workspace.
Calls superclass method
LittleGhost::Sandbox::new
# File lib/little_ghost/sandboxes/native.rb, line 11 def self.probe(platform: RUBY_PLATFORM, **options) implementation = if platform.include?("darwin") Seatbelt elsif platform.include?("linux") Bubblewrap else return {available: false, reason: "native sandboxing is unavailable on #{platform}", capabilities: Capabilities.new(features: [], network_modes: [])} end implementation.probe(platform:, **options) end
Reports whether the native backend for platform is available and returns its capabilities.
Public Instance Methods
Source
# File lib/little_ghost/sandboxes/native.rb, line 37 def capabilities = @backend.capabilities
Source
# File lib/little_ghost/sandboxes/native.rb, line 36 def effective_policy = @backend.effective_policy
Source
# File lib/little_ghost/sandboxes/native.rb, line 44 def execute_program(...) = @backend.execute_program(...)
Source
# File lib/little_ghost/sandboxes/native.rb, line 41 def list(...) = @backend.list(...)
Source
# File lib/little_ghost/sandboxes/native.rb, line 38 def open(run: nil) = @backend.open(run:)
Source
# File lib/little_ghost/sandboxes/native.rb, line 40 def read(...) = @backend.read(...)
Source
# File lib/little_ghost/sandboxes/native.rb, line 43 def replace(...) = @backend.replace(...)
Source
# File lib/little_ghost/sandboxes/native.rb, line 46 def scope(...) = @backend.scope(...)
Source
# File lib/little_ghost/sandboxes/native.rb, line 45 def start_program(...) = @backend.start_program(...)
Source
# File lib/little_ghost/sandboxes/native.rb, line 42 def write(...) = @backend.write(...)