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 ¶
- func Allows(method string) bool
- func CallerField(method string) string
- func Force(ctx context.Context, force bool) error
- func Impersonation(method, claimed, session string) string
- func Method(path string) string
- func Refusal(method string) string
- func Session(ctx context.Context) string
- func Target(ctx context.Context, label string, confined bool) error
- func With(ctx context.Context, session string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallerField ¶
CallerField is the options field that must name the calling session, "" when the method has none.
func Force ¶
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 ¶
Impersonation is the error for an allowed method whose options name another session as the caller.
func Refusal ¶
Refusal is the error a confined session reads when it calls a method its token does not cover.
func Session ¶
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 ¶
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.
Types ¶
This section is empty.