trust

package
v0.84.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package trust manages a persisted allowlist of project directories that the user has marked as trusted for loading project-local skills.

Project-local skills (discovered under <project>/.agents/skills/ and <project>/.kit/skills/) are injected into the system prompt. A freshly cloned, untrusted repository could therefore smuggle instructions into the agent the moment the user runs Kit inside it. To mitigate this prompt- injection vector, project-level skill loading can be gated on an explicit trust decision recorded here.

The allowlist is stored as JSON at $XDG_CONFIG_HOME/kit/trusted-projects.json (default ~/.config/kit/trusted-projects.json).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

DefaultPath returns the path the trust allowlist is persisted to, respecting $XDG_CONFIG_HOME. Returns the empty string when no home directory can be determined.

Types

type Decision

type Decision int

Decision is the outcome of a trust prompt.

const (
	// Skip declines to load project skills this session and records nothing.
	Skip Decision = iota
	// Trust loads project skills this session and persists the directory.
	Trust
	// TrustOnce loads project skills this session without persisting.
	TrustOnce
)

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a persisted set of trusted project directories. The zero value is not usable — construct one with Load.

func Load

func Load(path string) (*Store, error)

Load reads the trust allowlist from path. A missing file yields an empty store (not an error). Pass an empty path to use DefaultPath.

func (*Store) IsTrusted

func (s *Store) IsTrusted(dir string) bool

IsTrusted reports whether dir has been marked trusted.

func (*Store) Trust

func (s *Store) Trust(dir string) error

Trust records dir as trusted and persists the allowlist to disk.

func (*Store) Untrust

func (s *Store) Untrust(dir string) error

Untrust removes dir from the allowlist and persists the change.

Jump to

Keyboard shortcuts

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