scope

package
v0.93.0-rc.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package scope is what a confined session may ask of lich's loopback listener. A session running in the sandbox is handed a token minted for it alone (internal/terminal), never the launch-wide one, and every request made with it is held to this policy: an allowlist of RPC methods, and on the methods that name their caller, the rule that the caller is the session the token was minted for.

Deny by default. The list is derived from what a confined agent legitimately does through lich-plugin's hooks, the `lich` CLI and `lich mcp`: talk to the sessions around it, open and steer sessions (which come out confined too, internal/spawn), drive its own browser, read the project's services and its cost. Everything that runs a command on the machine outside the sandbox (services.Start and the other service writes), moves a setting (store.SetSetting), types into another session's PTY (terminal.Write), hands the backend a host path, or belongs to the window alone is out.

The relay is allowed and held to a second rule where the method resolves its target (Target): text a confined session puts at another session's prompt is carried out by that session as its task, so the target has to be confined too, or the message is terminal.Write under another name. A reply goes to anyone, since the recipient reads it as a result.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Allows

func Allows(method string) bool

Allows reports whether a scoped token may call method at all.

func CallerField

func CallerField(method string) string

CallerField is the options field that must name the calling session, "" when the method has none.

func Force

func Force(ctx context.Context, force bool) error

Force refuses a confined caller the force that removes a checkout with uncommitted work: the checkout is outside its sandbox, and what the force discards exists nowhere else.

func Impersonation

func Impersonation(method, claimed, session string) string

Impersonation is the error for an allowed method whose options name another session as the caller.

func Method

func Method(path string) string

Method is the RPC method a request path names, "" for anything that is not an RPC.

func Refusal

func Refusal(method string) string

Refusal is the error a confined session reads when it calls a method its token does not cover.

func Session

func Session(ctx context.Context) string

Session is the confined session a request was made by, "" for the window, the command line outside a sandbox and every other holder of the launch token.

func Target

func Target(ctx context.Context, label string, confined bool) error

Target refuses a confined caller a session that is not itself confined, for a method that puts text at the target's prompt: the receiving agent carries a message out as its task, so a confined session writing "run X" into an unconfined card is terminal.Write under another name. confined is the target's row (store.SessionConfined). A reply is not held to this: the recipient reads it as a result, and it is how a confined worker reports to an unconfined parent.

func With

func With(ctx context.Context, session string) context.Context

With marks ctx as a request made with a scoped token minted for session.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL