evaluator

package
v0.0.0-...-360ba47 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateContentHash

func CalculateContentHash(content string) string

CalculateContentHash calculates SHA256 hash of content

func CreateBackup

func CreateBackup(filePath string) (string, error)

CreateBackup creates a backup of an existing file

func ExecuteExec

func ExecuteExec(cmd scanner.Command, cfg *config.Config, auditLog func(cmdType, arg string, success bool, errMsg string)) scanner.ExecutionResult

ExecuteExec handles the "exec" command

func ExecuteOpen

func ExecuteOpen(filepath string, cfg *config.Config, auditLog func(cmd, arg string, success bool, errMsg string), pool *sandbox.ContainerPool) scanner.ExecutionResult

ExecuteOpen handles the "open" command

func ExecuteSearch

func ExecuteSearch(query string, cfg *config.Config, searchCfg *search.SearchConfig, auditLog func(cmd, arg string, success bool, errMsg string)) scanner.ExecutionResult

ExecuteSearch handles the "search" command

func ExecuteWrite

func ExecuteWrite(filePath, content string, cfg *config.Config, auditLog func(cmd, arg string, success bool, errMsg string), pool *sandbox.ContainerPool) scanner.ExecutionResult

ExecuteWrite handles the "write" command

func FormatContent

func FormatContent(filePath, content string) string

FormatContent formats content based on file type. Returns the original content unchanged if formatting fails or the file type is not supported.

func SanitizeError

func SanitizeError(err error) error

SanitizeError removes sensitive information from error messages Returns a safe error suitable for untrusted LLM consumption

Types

type Executor

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

Executor handles command execution

Security Model: - Container is the security boundary (all mounted repo is sacrificial on compromise) - No path-level validation; LLM has unrestricted filesystem access within container - Symlinks are treated as normal filesystem objects - All operations audited to audit.log - Host protected by container namespace isolation and read-only mounts where appropriate

func NewExecutor

func NewExecutor(cfg *config.Config, searchCfg *search.SearchConfig, auditLog func(cmd, arg string, success bool, errMsg string), pool *sandbox.ContainerPool) *Executor

NewExecutor creates a new executor instance

func (*Executor) Execute

Execute dispatches command execution based on type

func (*Executor) GetCommandsRun

func (e *Executor) GetCommandsRun() int

GetCommandsRun returns the number of successfully executed commands

func (*Executor) GetConfig

func (e *Executor) GetConfig() *config.Config

GetConfig returns the executor's configuration

func (*Executor) GetPool

func (e *Executor) GetPool() *sandbox.ContainerPool

GetPool returns the executor's container pool

func (*Executor) GetSearchConfig

func (e *Executor) GetSearchConfig() *search.SearchConfig

GetSearchConfig returns the executor's search configuration

Jump to

Keyboard shortcuts

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