Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI Shell Team Aish SecurityManager analyze with sandbox

From Leeroopedia
Knowledge Sources
Domains Security, Sandboxing
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete tool for trial-running AI commands in an overlay filesystem sandbox and assessing the results provided by the aish-security crate.

= Description

The SecurityManager::analyze_with_sandbox method sends the command to the sandbox daemon via IPC. The sandbox runs the command in an overlay filesystem and returns the filesystem changes, exit code, and any errors. If the CWD is outside the repo root, the sandbox is skipped and degraded mode is used instead.

The assess_sandbox_result function evaluates the sandbox result: no changes → default risk level; non-zero exit → medium risk; changes → evaluated against policy rules via match_rule.

Usage

This method is called internally by analyze_with_request when the sandbox is enabled. No direct call is needed by external code.

Code Reference

Source Location

  • Repository: aish
  • File: crates/aish-security/src/manager.rs (analyze_with_sandbox), crates/aish-security/src/sandbox/assess.rs (assess_sandbox_result)

Signature

impl SecurityManager {
    fn analyze_with_sandbox(
        &self,
        command: &str,
        request: &SecurityRequest,
    ) -> SecurityAnalysis
}

// In sandbox/assess.rs:
pub(crate) fn assess_sandbox_result(
    policy: &SecurityPolicy,
    command: &str,
    sandbox: &SandboxResult,
) -> SecurityAnalysis

Import

// Internal to the security pipeline; called by analyze_with_request
use aish_security::sandbox::assess::assess_sandbox_result;

I/O Contract

Inputs

Name Type Required Description
command &str Yes Command to sandbox-run
request &SecurityRequest Yes cwd, repo_root, sandbox socket path, timeout

Outputs

Name Type Description
return SecurityAnalysis Risk level based on filesystem changes, exit code, sandbox status

Usage Examples

Sandbox Pre-Run (Internal)

// This is called internally by analyze_with_request:
// if policy.enable_sandbox:
//     analysis = manager.analyze_with_sandbox(command, request)

// The sandbox result is assessed by assess_sandbox_result:
// - No changes → default_risk_level
// - Non-zero exit → Medium (confirm)
// - Changes → matched against policy rules

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment