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

Principle:23blocks OS Ai maestro Input Sanitization

From Leeroopedia
Knowledge Sources
Domains Security, Input_Validation
Last Updated 2026-10-26 10:00 GMT

Overview

A whitelist validation pattern where untrusted user-supplied options are validated against a known per-tool declaration list, dropping anything unknown or invalid.

Description

Input sanitization in AI Maestro follows a strict whitelist approach. The `sanitizeLaunchOptions` function validates user-supplied launch options against a per-tool declaration list. Anything not declared (unknown option id, wrong type, a value that fails its pattern, a choice not on the list) is dropped. A toggle counts only when it is exactly `true`.

This differs from blacklist sanitization (stripping known-bad characters) in that only explicitly allowed values survive. The agent name itself is validated with a regex (`^[a-zA-Z0-9/_.-]+$`) to prevent shell injection via crafted names.

Usage

Use this principle when:

  • Untrusted user input feeds into shell commands
  • External commands must go through argv, never shell strings
  • A known set of valid options exists per tool type

Theoretical Basis

Whitelist validation (allow-listing) is the security principle that only explicitly permitted values pass validation. It is stronger than blacklist validation (deny-listing) because new attack vectors are automatically rejected:

sanitize(kind, raw) =
  for each declared option in launchOptionsFor(kind):
    if raw[option.id] matches declaration:
      include it
    else:
      drop it
  return only included options

The alternative — building tmux/shell commands with string interpolation — is rejected. All external commands go through `execFile` + argv via `lib/tmux-safe.mjs`. Session names must match `^[a-zA-Z0-9_-]+$`.

Related Pages

Implemented By

Page Connections

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